/* ==========================================================================
   KickoffScout — folha de estilo
   Tokens primeiro; claro por defeito, escuro com prefers-color-scheme.
   ========================================================================== */
:root {
  color-scheme: light;
  --page: #f5f6f3;
  --surface-1: #ffffff;
  --surface-2: #f0f1ed;
  --text-primary: #111412;
  --text-secondary: #4d534f;
  --muted: #737975;
  --grid: #e5e7e2;
  --axis: #c9ccc6;
  --border: rgba(17, 20, 18, 0.09);
  --shadow: 0 1px 2px rgba(17, 20, 18, .04), 0 4px 16px rgba(17, 20, 18, .05);
  --accent: #0f8a4a;
  --accent-soft: rgba(15, 138, 74, .10);
  --series-1: #0f8a4a;
  --series-2: #e0662f;
  --series-3: #2a6fd6;
  --series-4: #c98a00;
  --pos: #0f8a4a;
  --neg: #d23f3f;
  --good: #0b7a40;
  --good-fill: #12924f;
  --critical: #d23f3f;
  --warning: #e0a100;
  --serious: #e0662f;
  --ref: #7b817d;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 880px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0c0e0d;
    --surface-1: #151817;
    --surface-2: #1c201e;
    --text-primary: #eef1ee;
    --text-secondary: #b9c0bb;
    --muted: #8a918c;
    --grid: #262b28;
    --axis: #39403c;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --accent: #2fbf71;
    --accent-soft: rgba(47, 191, 113, .13);
    --series-1: #2fbf71;
    --series-2: #ef7a45;
    --series-3: #5b95f0;
    --series-4: #e0a92a;
    --pos: #2fbf71;
    --neg: #ef6464;
    --good: #3fd07f;
    --good-fill: #1f9d58;
    --critical: #ef6464;
  }
}

/* ---- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--page); color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
b, strong { font-weight: 650; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.saltar { position: absolute; left: -999px; top: 8px; background: var(--surface-1); padding: 8px 12px; border-radius: 8px; z-index: 20; }
.saltar:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { *, *::before { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* ---- topo */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface-1) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topo-in { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px 0; }
.marca-linha { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.marca { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 17px; letter-spacing: -.01em;
  color: var(--text-primary); text-decoration: none; }
.marca svg { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 1px 2px rgb(0 0 0 / .18)); }
.marca-nome { font-size: 19px; font-weight: 800; letter-spacing: -.025em; }
.marca-dest { color: var(--accent); }
.modo { font-size: 11px; font-weight: 700; letter-spacing: .05em; padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.modo.real { background: var(--critical); color: #fff; }
nav { display: flex; gap: 2px; overflow-x: auto; margin-top: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
nav::-webkit-scrollbar { display: none; }
nav a { white-space: nowrap; color: var(--text-secondary); text-decoration: none; padding: 9px 11px 10px; font-size: 14px; font-weight: 550;
  border-bottom: 2px solid transparent; }
nav a:hover { color: var(--text-primary); }
nav a[aria-current="page"] { color: var(--text-primary); border-bottom-color: var(--accent); font-weight: 700; }
/* esbatido na borda das barras que deslizam (classes postas pelo app.js) */
.mais-dir { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.mais-esq { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px);
  mask-image: linear-gradient(to right, transparent, #000 36px); }
.mais-esq.mais-dir { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

/* ---- estrutura */
main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 8px; flex: 1; }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 4px; letter-spacing: -.02em; }
.lead { color: var(--text-secondary); margin: 0 0 16px; }
h2 { font-size: 18px; margin: 28px 0 10px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sec { color: var(--text-secondary); }
.pequeno { font-size: 12.5px; }
.bom { color: var(--good); }

/* ---- rodapé */
.rodape { border-top: 1px solid var(--border); margin-top: 32px; background: var(--surface-1); }
.rodape-in { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 28px; font-size: 12.5px; color: var(--muted); }
.rodape-in p { margin: 6px 0; }
.rodape .resp { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-weight: 600; font-size: 13px; }
.rodape .idade { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--critical); color: var(--critical); font-size: 11px; font-weight: 800; flex: none; }
.rodape a { color: var(--text-secondary); }
.rodape .links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; }

/* ---- blocos genéricos */
.aviso { border: 1px solid var(--border); border-left: 4px solid var(--warning); background: var(--surface-1);
  padding: 10px 12px; border-radius: var(--radius-sm); margin: 10px 0; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px; box-shadow: var(--shadow); }
.vazio { padding: 28px 18px; text-align: center; color: var(--muted); background: var(--surface-1);
  border: 1px dashed var(--axis); border-radius: var(--radius); }
.vazio b { color: var(--text-primary); display: block; font-size: 16px; margin-bottom: 4px; }

/* ---- chips / estados */
.tip-topo { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tip-jogo { font-weight: 650; }
.tip-aposta { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.chip b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.estado { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }
.estado.ganha { color: var(--good); } .estado.perdida { color: var(--critical); }
.estado.pendente { color: var(--text-secondary); } .estado.anulada { color: var(--muted); }
.res { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  text-transform: none; letter-spacing: 0; white-space: nowrap; }
.res.ganha { color: #fff; background: var(--good-fill); }
.res.perdida { color: #fff; background: var(--critical); }
.res.anulada { color: var(--text-secondary); border: 1px solid var(--border); }
.grav { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; margin-right: 6px; }
.grav.grave { color: var(--critical); } .grav.moderado { color: var(--serious); } .grav.leve { color: var(--muted); }

/* ---- details */
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); font-weight: 650; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px;
  padding: 8px 0; user-select: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin: 0 5px 0 2px; flex: none; }
details[open] > summary::before { transform: rotate(45deg); }
details ul { padding-left: 18px; margin: 6px 0; }
details li { margin-bottom: 4px; }
.card details { border-top: 1px solid var(--grid); margin-top: 12px; padding-top: 2px; }
.card details + details { margin-top: 0; }

/* ---- tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.tile .k { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .s { font-size: 12px; color: var(--muted); }

/* ---- tabelas */
.tabela { width: 100%; overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 650; font-size: 12px; position: sticky; top: 0; background: var(--surface-1); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 220px; }
tr:last-child td { border-bottom: 0; }

/* ---- filtros e controlos */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.filtros label { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px; font-weight: 600; }
select, input[type="date"] { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--axis);
  background: var(--surface-1); color: var(--text-primary); min-height: 40px; }
.dias { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 14px; scrollbar-width: none; }
.dias::-webkit-scrollbar { display: none; }
.dias button { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--axis); min-height: 38px;
  background: var(--surface-1); color: var(--text-secondary); white-space: nowrap; cursor: pointer; font-weight: 550; }
.dias button:hover { color: var(--text-primary); }
.dias button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); font-weight: 700; }
.ligas-chips { display: flex; gap: 6px; overflow-x: auto; margin: 16px 0 4px; scrollbar-width: none; padding-bottom: 2px; }
.ligas-chips::-webkit-scrollbar { display: none; }
.ligas-chips button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary); white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.ligas-chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 700; }
.ligas-chips .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- gráficos */
.grafico { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; position: relative; box-shadow: var(--shadow); }
.grafico h3 { margin: 0 0 2px; font-size: 14px; }
.grafico .sub { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.grafico svg { width: 100%; max-width: 100%; height: auto; display: block; overflow: visible; }
#g-cal svg { max-width: 420px; }
.legenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; }
.legenda i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.14);
  display: none; z-index: 3; max-width: 260px; }
.tooltip .t { color: var(--text-secondary); font-size: 11.5px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* ---- liga */
.liga-titulo { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 750; margin: 22px 0 8px;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; }
.liga-titulo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.liga-titulo .n { margin-left: auto; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }

/* ---- cartão de jogo */
.jogo-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.equipas { font-weight: 700; font-size: 16.5px; line-height: 1.3; letter-spacing: -.01em; }
.vs { color: var(--muted); font-weight: 500; font-size: 13px; margin: 0 3px; }
.jogo-est { font-size: 13px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--surface-2); padding: 3px 10px; border-radius: 999px; font-weight: 650; }
.jogo-est.live { color: #fff; background: var(--serious); }
.jogo-est.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: 1px;
  animation: pulsar 1.4s ease-in-out infinite; }
.jogo-est.fim { color: var(--text-primary); }
.jogo-est.espera { color: var(--muted); font-weight: 550; }
@keyframes pulsar { 50% { opacity: .35; } }
.pick { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); border-left: 3px solid var(--accent); }
.pick.tip { border-left-color: var(--series-4); background: color-mix(in srgb, var(--series-4) 10%, var(--surface-2)); }
.pick .k { font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pick .v { font-size: 18px; font-weight: 750; margin: 3px 0 2px; letter-spacing: -.01em; line-height: 1.3; }
.pick .sec { font-size: 14px; }
.prob { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; }
.prob b { font-size: 18px; font-variant-numeric: tabular-nums; min-width: 44px; }
.prob .sec { font-size: 13px; }
.barra { flex: 1; max-width: 240px; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.barra span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.selo { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.selo.tip { background: var(--series-1); color: #fff; }
.perna { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.perna:last-child { border-bottom: 0; }
.perna > span:last-child { text-align: right; }
.opcoes { margin-top: 4px; }
.opcao { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.opcao:last-child { border-bottom: 0; }
.opcao > span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sub-t { font-weight: 750; color: var(--text-primary); margin: 16px 0 4px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.agente { padding: 10px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.agente:last-of-type { border-bottom: 0; }

/* ---- resumo do dia */
.resumo { background: linear-gradient(180deg, var(--accent-soft), transparent 140px), var(--surface-1); }
.resumo .k { font-size: 11.5px; color: var(--accent); font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.resumo .linha { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--grid); color: var(--text-primary); text-decoration: none; font-size: 14px; }
.resumo .linha:hover .nome b { text-decoration: underline; }
.resumo .linha:last-of-type { border-bottom: 0; }
.resumo .pp { text-align: right; white-space: nowrap; }
.resumo .pp b { font-size: 16px; }
.resumo .hora { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-weight: 600; }
.placar-dia { font-size: 15px; margin: 8px 0; }
.dupla-dia { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--grid); font-size: 14px; color: var(--text-secondary); }
.ajuda { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 14px; margin: 0 0 12px; }
.ajuda ul { margin: 2px 0 12px; padding-left: 18px; font-size: 14px; color: var(--text-secondary); }
.ajuda li { margin-bottom: 6px; }
.ajuda b { color: var(--text-primary); }

/* ---- histórico */
.hist-linha { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.hist-linha:last-child { border-bottom: 0; }
.hist-linha .pp { text-align: right; white-space: nowrap; }
.hist-linha .res { margin-left: 0; }
.card.lista { padding-top: 6px; padding-bottom: 6px; }

/* ---- página "Como funciona" */
.passos { counter-reset: p; list-style: none; padding: 0; margin: 0; }
.passos li { counter-increment: p; position: relative; padding: 0 0 16px 42px; color: var(--text-secondary); }
.passos li:last-child { padding-bottom: 0; }
.passos li::before { content: counter(p); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.passos b { display: block; color: var(--text-primary); }
.texto p { margin: 8px 0; color: var(--text-secondary); }
.texto ul { padding-left: 18px; color: var(--text-secondary); }
.texto li { margin-bottom: 6px; }
.texto b { color: var(--text-primary); }

@media (min-width: 640px) {
  main { padding-top: 26px; }
  h1 { font-size: 30px; }
  .card { padding: 18px 20px; }
}

/* ---- valor, copiar, ordenar */
.pick.risco { border-left-color: var(--serious); background: color-mix(in srgb, var(--serious) 8%, var(--surface-2)); }
.selo.risco { color: var(--serious); background: color-mix(in srgb, var(--serious) 14%, transparent); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle; letter-spacing: 0; }
h2 .selo.risco { margin-left: 6px; }
.pick.valor {border-left-color: var(--series-4); background: color-mix(in srgb, var(--series-4) 11%, var(--surface-2)); }
.pick .k .copiar { margin-left: auto; }
.copiar { font: inherit; font-size: 11.5px; font-weight: 650; text-transform: none; letter-spacing: 0; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--axis); background: var(--surface-1); color: var(--text-secondary); cursor: pointer; min-height: 26px; margin-left: 6px; }
.copiar:hover { color: var(--text-primary); }
.copiar.ok { color: var(--good); border-color: var(--good); }
.barra-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 4px; }
.barra-ctl .ligas-chips { margin: 0; flex: 1; min-width: 0; }
.ordem { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface-1); flex: none; }
.ordem button { font: inherit; font-size: 13px; padding: 6px 12px; border: 0; background: transparent; color: var(--text-secondary); cursor: pointer; min-height: 34px; }
.ordem button[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); font-weight: 700; }
.mau { color: var(--critical); }
@media (max-width: 639px) { .barra-ctl .ligas-chips { flex-basis: 100%; } .barra-ctl .ordem { margin-left: auto; } }
