:root {
  --bg: #0d0f14; --card-bg: #151821; --card-header: #1c212d; --border: #242b3b;
  --text: #e2e8f0; --text-muted: #8899aa; --green: #10b981; --green-dark: #065f46;
  --yellow: #f59e0b; --red: #ef4444; --cyan: #06b6d4; --accent: #3b82f6; --pill-bg: #1e2433; --purple: #a78bfa;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
body { background: var(--bg); color: var(--text); padding: 20px 10px; display: flex; justify-content: center; }
a { color: var(--cyan); }
.container { width: 100%; max-width: 540px; }
.container.wide { max-width: 760px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12px; font-weight: 700; }
.topbar a { text-decoration: none; }
.muted { color: var(--text-muted); }
.loading { color: var(--text-muted); text-align: center; padding: 40px 10px; font-size: 13px; }
.err { color: var(--red); text-align: center; padding: 30px 10px; font-size: 13px; }

/* ---------- Agenda ---------- */
.hdr { background: linear-gradient(180deg,#0f2a22 0%,#161a24 100%); border: 1px solid #1f3d33; border-radius: 16px; padding: 18px 16px; margin-bottom: 14px; }
.hdr h1 { font-size: 18px; font-weight: 900; letter-spacing: .3px; }
.hdr .sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-top: 12px; }
.kpi { background: #0d0f14; border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; }
.kpi .l { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.kpi .v { font-size: 18px; font-weight: 900; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 20px; cursor: pointer; }
.chip.on { background: rgba(16,185,129,.12); border-color: var(--green); color: var(--green); }
.day { margin-bottom: 16px; }
.day-h { font-size: 13px; font-weight: 900; text-transform: uppercase; color: #fff; padding: 8px 4px; border-bottom: 1px solid var(--border); margin-bottom: 8px; display: flex; justify-content: space-between; }
.cnt { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.liga { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.liga-h { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--cyan); display: flex; justify-content: space-between; margin-bottom: 4px; }
.row { display: grid; grid-template-columns: 64px 1fr 190px 130px; gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.row:last-child { border-bottom: none; }
.hora { font-size: 14px; font-weight: 900; color: #fff; }
.st { font-size: 9px; font-weight: 700; text-transform: uppercase; margin-top: 2px; }
.st.ns { color: var(--text-muted); } .st.live { color: var(--yellow); } .st.ft { color: var(--green); }
.teams .t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin: 1px 0; }
.teams img { width: 16px; height: 16px; object-fit: contain; }
.odds { display: flex; flex-wrap: wrap; gap: 4px; }
.op { font-size: 10px; color: var(--text-muted); background: #0d0f14; border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
.op b { color: #fff; font-size: 11px; }
.no-odds { font-size: 10px; color: var(--text-muted); font-style: italic; }
.act { text-align: right; }
.open { display: inline-block; font-size: 10px; font-weight: 800; color: var(--purple); border: 1px solid rgba(167,139,250,.45); border-radius: 8px; padding: 6px 8px; text-decoration: none; }
.open:hover { background: rgba(167,139,250,.15); }
.fid { font-size: 9px; color: var(--text-muted); margin-top: 3px; font-family: monospace; }
.foot { font-size: 10px; color: var(--text-muted); line-height: 1.5; margin-top: 10px; }
@media (max-width: 640px) {
  body { padding: 12px 8px; }
  .hdr { padding: 14px 12px; }
  .hdr h1 { font-size: 15px; }
  .hdr .sub { font-size: 11px; }
  .kpis { grid-template-columns: repeat(4,1fr); gap: 6px; }
  .kpi { padding: 6px 4px; } .kpi .l { font-size: 8px; } .kpi .v { font-size: 15px; }
  .chip { padding: 7px 10px; }
  .liga { padding: 8px 10px; }
  .row { grid-template-columns: 50px 1fr auto; gap: 6px; padding: 8px 0; }
  .hora { font-size: 13px; }
  .teams .t { font-size: 12px; }
  .hora { grid-column: 1; grid-row: 1; } .teams { grid-column: 2; grid-row: 1; }
  .odds { grid-column: 1 / -1; grid-row: 2; gap: 4px; }
  .op { font-size: 10px; padding: 3px 5px; }
  .act { grid-column: 3; grid-row: 1; text-align: right; align-self: center; }
  .open { padding: 6px 8px; font-size: 10px; }
  .open .full { display: none; }
  .fid { display: none; }
}
@media (min-width: 641px) { .open .short { display: none; } }

/* ---------- H2H ---------- */
.match-header { background: linear-gradient(180deg,#2b1118 0%,#161a24 100%); border-radius: 16px; padding: 20px 16px; text-align: center; margin-bottom: 14px; border: 1px solid #3d1c24; box-shadow: 0 4px 20px rgba(0,0,0,.4); }
.league-badge { display: inline-block; background: rgba(255,255,255,.08); padding: 4px 12px; border-radius: 20px; font-size: 12px; margin-bottom: 14px; font-weight: 600; }
.teams-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.team-box { flex: 1; text-align: center; }
.team-box img { width: 54px; height: 54px; object-fit: contain; margin-bottom: 6px; }
.team-box h3 { font-size: 15px; font-weight: 700; }
.vs-box { font-size: 24px; font-weight: 900; color: #fff; min-width: 100px; }
.vs-box .time { font-size: 11px; color: var(--text-muted); font-weight: normal; margin-top: 4px; }
.controls-card { background: var(--card-bg); border-radius: 12px; padding: 14px; margin-bottom: 14px; border: 1px solid var(--border); }
.select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
select { width: 100%; background: #0f1117; border: 1px solid var(--border); color: var(--text); padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; outline: none; }
select:focus { border-color: var(--green); }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--yellow); cursor: pointer; user-select: none; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-row input { cursor: pointer; accent-color: var(--yellow); width: 18px; height: 18px; }
.games-count-badge { background: rgba(245,158,11,.2); color: var(--yellow); font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.summary-card { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 14px; border: 1px solid var(--border); }
.summary-title { font-size: 12px; color: var(--text-muted); text-transform: uppercase; font-weight: 800; letter-spacing: .5px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.summary-title span.badge-market { background: rgba(6,182,212,.15); color: var(--cyan); padding: 3px 8px; border-radius: 6px; }
.kpi-section { margin-bottom: 12px; } .kpi-section:last-child { margin-bottom: 0; }
.kpi-section-header { font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kpi-section-header.marca { color: var(--green); } .kpi-section-header.sofre { color: var(--red); }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.kpi-box { background: #0d0f14; padding: 10px 6px; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.kpi-box.highlight-marca { border-color: rgba(16,185,129,.5); background: rgba(16,185,129,.08); }
.kpi-box.highlight-sofre { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.08); }
.kpi-label { font-size: 10px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.kpi-value { font-size: 20px; font-weight: 900; color: #fff; }
.kpi-box.highlight-marca .kpi-value { color: var(--green); } .kpi-box.highlight-sofre .kpi-value { color: var(--red); }
.odds-card { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 14px; border: 1px solid rgba(167,139,250,.35); }
.odds-title { font-size: 12px; color: var(--purple); text-transform: uppercase; font-weight: 800; letter-spacing: .5px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.odds-title .odds-meta { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: none; text-align: right; }
.odds-title .odds-meta a { color: var(--cyan); text-decoration: none; }
.odds-h2h-row { display: grid; grid-template-columns: repeat(5,1fr); gap: 6px; margin-bottom: 12px; }
.odds-pill { background: #0d0f14; border: 1px solid var(--border); border-radius: 8px; text-align: center; padding: 6px 4px; }
.odds-pill .lbl { font-size: 9px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.odds-pill .val { font-size: 15px; font-weight: 900; color: #fff; }
.odds-market-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin: 6px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.odds-market-title .badge-market { background: rgba(167,139,250,.15); color: var(--purple); padding: 3px 8px; border-radius: 6px; }
.odds-scopes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .odds-scopes { grid-template-columns: 1fr; } }
.odds-scope { background: #0d0f14; border: 1px solid var(--border); border-radius: 8px; padding: 8px 6px; }
.odds-scope-header { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.odds-scope-header .ref { color: var(--green); }
.odds-line { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 4px; align-items: center; font-size: 11px; padding: 4px 3px; border-radius: 6px; border: 1px solid transparent; }
.odds-line.near { border-color: rgba(16,185,129,.55); background: rgba(16,185,129,.08); }
.odds-line .ln { font-weight: 900; color: #fff; font-family: monospace; }
.odds-line .ou { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.odds-line .ou .o { font-weight: 800; color: #fff; }
.odds-line .ou .o.over { color: var(--green); } .odds-line .ou .o.under { color: var(--red); }
.odds-line .ou .hit { font-size: 9px; color: var(--text-muted); font-family: monospace; }
.odds-line .ou .hit.good { color: var(--yellow); }

/* ---- a base histórica do FutMax na linha (2026-08-23) ----
   Terceira linha de cada lado. Fica ABAIXO do H2H de propósito: o H2H é o confronto
   (10 jogos), a base é a amostra grande. O número em destaque é o CALIBRADO; o bruto
   vai entre parênteses, apagado, porque é ele que engana — quando existe odd na
   faixa, a taxa crua superestima. */
.odds-line .ou .base { font-size: 9px; color: var(--text-muted); font-family: monospace; margin-top: 1px; opacity: .95; }
.odds-line .ou .base.vale { color: var(--cyan); }        /* calibrado ainda paga a odd */
.odds-line .ou .base.vazio { opacity: .35; }
.odds-line .ou .base-sub { font-size: 8px; color: var(--text-muted); font-family: monospace; opacity: .5; line-height: 1.1; }
.odds-line .ou .base .flag { font-weight: 900; padding: 0 1px; border-radius: 3px; }
.odds-line .ou .base .flag.curta { color: var(--yellow); }  /* amostra abaixo da referência */
.odds-line .ou .base .flag.gap { color: var(--red); }       /* discordância alta = risco */
.odds-empty { color: var(--text-muted); font-size: 11px; text-align: center; padding: 10px 6px; }
.odds-note { font-size: 10px; color: var(--text-muted); margin-top: 8px; line-height: 1.4; }
/* legenda curta (2026-08-23): símbolos em uma linha; a explicação mora no "como ler" */
.odds-legend { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 10px; color: var(--text-muted); }
.odds-legend .lg b { font-weight: 800; }
.odds-legend .lg-y { color: var(--yellow); } .odds-legend .lg-g { color: var(--green); }
.odds-legend .lg-c { color: var(--cyan); }   .odds-legend .lg-n { color: var(--yellow); } .odds-legend .lg-r { color: var(--red); }
.odds-legend .lg-sep { opacity: .35; }
.odds-warn { margin-top: 5px; font-size: 10px; color: var(--yellow); opacity: .85; }
.odds-help { margin-top: 6px; font-size: 10px; color: var(--text-muted); }
.odds-help summary { cursor: pointer; color: var(--cyan); font-weight: 700; opacity: .85; user-select: none; list-style: none; }
.odds-help summary::-webkit-details-marker { display: none; }
.odds-help summary::before { content: '▸ '; } .odds-help[open] summary::before { content: '▾ '; }
.odds-help ul { margin: 6px 0 0 14px; padding: 0; line-height: 1.45; }
.odds-help li { margin: 2px 0; } .odds-help li b { color: var(--text); font-weight: 700; }
.games-card { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 14px; border: 1px solid var(--border); }
.games-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.games-header h4 { font-size: 13px; font-weight: 800; text-transform: uppercase; }
.form-badges { display: flex; gap: 4px; }
.badge { width: 22px; height: 22px; border-radius: 4px; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.badge.V { background: var(--green); color: #000; } .badge.E { background: var(--yellow); color: #000; } .badge.D { background: var(--red); color: #fff; }
.match-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13px; }
.match-item:last-child { border-bottom: none; }
.match-date { font-size: 11px; color: var(--text-muted); width: 44px; }
.match-names { flex: 1; padding: 0 10px; }
.match-names .team-line { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.match-names .team-line:last-child { margin-bottom: 0; }
.match-names .team-name { color: var(--text-muted); font-size: 13px; }
.match-names .team-name.bold { font-weight: 800; color: #fff; }
.match-names .team-stat { font-weight: 800; font-size: 14px; color: var(--yellow); min-width: 24px; text-align: right; }
.match-side-info { display: flex; align-items: center; gap: 10px; margin-left: 8px; }
.match-score-pill { font-size: 11px; color: var(--text-muted); background: #0d0f14; border: 1px solid var(--border); padding: 3px 6px; border-radius: 4px; font-family: monospace; }
.ver-mais-btn { width: 100%; background: #1c2230; border: 1px solid var(--border); color: var(--cyan); font-size: 12px; font-weight: 700; padding: 10px; border-radius: 8px; cursor: pointer; text-transform: uppercase; letter-spacing: .5px; margin-top: 10px; }
.ver-mais-btn:hover { background: rgba(6,182,212,.15); border-color: var(--cyan); }
.tabs-nav { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn { flex: 1; text-align: center; padding: 8px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer; }
.tab-btn.active { background: rgba(59,130,246,.15); border-color: var(--accent); color: var(--accent); }

/* ---------- H2H mobile ---------- */
@media (max-width: 480px) {
  .tab-btn { font-size: 11px; padding: 8px 4px; }
  .match-header { padding: 14px 10px; }
  .team-box img { width: 44px; height: 44px; }
  .team-box h3 { font-size: 13px; }
  .vs-box { font-size: 20px; min-width: 84px; }
  .select-grid { gap: 8px; }
  select { padding: 9px 8px; font-size: 12px; }
  .checkbox-row { font-size: 12px; padding: 9px 10px; }
  .kpi-value { font-size: 18px; }
  .odds-title { flex-direction: column; align-items: flex-start; }
  .odds-title .odds-meta { text-align: left; }
}
