:root {
  --night: #0a1a3f;
  --night-2: #13275a;
  --ink: #0e1630;
  --muted: #5b6480;
  --ground: #f1f3f8;
  --surface: #ffffff;
  --surface-2: #e9edf5;
  --line: #d8deea;
  --accent: #2456e6;
  --gold: #d9a514;
  --win: #178a4f;
  --draw: #8a93a8;
  --loss: #c43b3b;
  --z1: #dff3e8;
  --z1-ink: #146b3f;
  --z2: #e3ebff;
  --z2-ink: #2447b8;
  --radius: 10px;
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* topo */
.top { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px 0; display: flex; flex-direction: column; gap: 8px; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand a { display: flex; align-items: baseline; gap: 8px; }
.brand b { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: .02em; text-transform: uppercase; line-height: 1; }
.brand span { font-size: 13px; opacity: .7; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn.dark { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn svg { width: 16px; height: 16px; }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a { padding: 10px 12px 12px; font-weight: 600; font-size: 15px; color: rgba(255,255,255,.72); border-bottom: 3px solid transparent; white-space: nowrap; }
nav.tabs a.on { color: #fff; border-color: var(--gold); }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; display: flex; flex-direction: column; gap: 28px; }
.print-head { display: none; }
.updated { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--loss); margin-right: 4px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } }

h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; text-wrap: balance; }
h1 { font-size: clamp(32px, 7vw, 48px); font-weight: 700; text-transform: uppercase; }
h2 { font-size: 26px; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
h3 { font-size: 20px; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
section { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.sec-head a { font-size: 14px; font-weight: 600; color: var(--accent); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.pad { padding: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

/* avatar */
.av { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: #fff; font-size: 17px; }
.av img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.av.lg { width: 64px; height: 64px; font-size: 24px; }
.logo { width: 28px; height: 28px; object-fit: contain; flex: none; }
.logo.lg { width: 72px; height: 72px; }
.logo.ph { display: inline-grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 10px; font-weight: 700; color: var(--muted); }

/* destaque do time favorito */
.fav { background: var(--night); color: #fff; border-radius: var(--radius); padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.fav .logo.lg { background: #fff; border-radius: 12px; padding: 6px; }
.fav h2 { font-size: 30px; }
.fav-stats { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 8px; }
.fav-stats div { display: flex; flex-direction: column; }
.fav-stats b { font-family: var(--display); font-size: 30px; line-height: 1; }
.fav-stats span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.fav-next { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.15); padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
.fav-next a { text-decoration: underline; text-underline-offset: 3px; }

/* partidas */
.matches { display: flex; flex-direction: column; }
.match { display: grid; grid-template-columns: 74px 1fr auto 1fr; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.match:first-child { border-top: 0; }
.match:hover { background: var(--surface-2); }
.match .when { font-size: 12px; color: var(--muted); line-height: 1.25; }
.match .when b { display: block; color: var(--ink); font-size: 14px; }
.match .side { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.match .side.home { justify-content: flex-end; text-align: right; }
.match .side span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .side.lost { color: var(--muted); font-weight: 400; }
.score { font-family: var(--display); font-size: 24px; font-weight: 700; min-width: 70px; text-align: center; background: var(--surface-2); border-radius: 6px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.score.pre { font-size: 16px; font-weight: 600; background: transparent; color: var(--muted); }
.score.live { background: var(--loss); color: #fff; }
.match .fav-row { box-shadow: inset 3px 0 0 var(--gold); }
.match.fav-row { box-shadow: inset 4px 0 0 var(--gold); }
@media (max-width: 560px) {
  .match { grid-template-columns: 1fr auto 1fr; padding: 10px; }
  .match .when { grid-column: 1 / -1; display: flex; gap: 8px; }
  .match .when b { display: inline; }
  .match .side { font-size: 14px; }
}
.group-title { padding: 10px 14px; background: var(--surface-2); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-top: 1px solid var(--line); }

/* tabelas */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th { text-align: right; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 8px; background: var(--surface-2); white-space: nowrap; }
td { text-align: right; padding: 9px 8px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
th.l, td.l { text-align: left; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td .team { display: flex; align-items: center; gap: 8px; font-weight: 600; }
td.rank { width: 40px; text-align: center; font-weight: 700; }
tr.z1 td.rank { background: var(--z1); color: var(--z1-ink); }
tr.z2 td.rank { background: var(--z2); color: var(--z2-ink); }
tr.fav td { background: #fff7dc; }
td.pts { font-weight: 700; font-size: 16px; }
.form { display: inline-flex; gap: 3px; }
.form i { font-style: normal; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.form .V { background: var(--win); } .form .E { background: var(--draw); } .form .D { background: var(--loss); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* times */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.team-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-weight: 600; }
.team-tile img, .team-tile .logo { width: 56px; height: 56px; }
.team-tile small { color: var(--muted); font-weight: 400; }
.team-tile:hover { border-color: var(--accent); }

.team-head { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 15px; }
.kv span { color: var(--muted); }

/* elenco */
.pos-title { font-family: var(--display); font-size: 20px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.squad { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.pcard:hover { border-color: var(--accent); }
.pcard .nm { font-weight: 700; line-height: 1.15; }
.pcard .meta { font-size: 13px; color: var(--muted); }
.pcard .mini { display: flex; gap: 10px; font-size: 13px; margin-top: 2px; }
.pcard .mini b { font-variant-numeric: tabular-nums; }
.shirt { font-family: var(--display); font-weight: 700; color: var(--muted); margin-right: 4px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tag.inj { background: #fde3e3; color: var(--loss); }

/* jogador */
.player { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
@media (max-width: 700px) { .player { grid-template-columns: 1fr; } }
.photo { width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--night); display: grid; place-items: center; color: #fff; font-family: var(--display); font-size: 88px; font-weight: 700; max-width: 100%; }
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
@media (max-width: 700px) { .photo { max-width: 260px; justify-self: center; } }
.credit { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.3; }
.credit a { text-decoration: underline; }
.p-title { display: flex; flex-direction: column; gap: 6px; }
.p-title .big-num { font-family: var(--display); font-size: 56px; font-weight: 700; line-height: .9; color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.facts div { display: flex; flex-direction: column; }
.facts span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.facts b { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.tile.hi b { color: var(--gold); }

/* súmula */
.scoreboard { background: var(--night); color: #fff; border-radius: var(--radius); padding: 18px 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.scoreboard .t { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.scoreboard .t img, .scoreboard .t .logo { width: 64px; height: 64px; background: #fff; border-radius: 12px; padding: 4px; }
.scoreboard .sc { font-family: var(--display); font-size: 56px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.scoreboard .st { font-size: 13px; opacity: .8; margin-top: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 48px 26px 1fr; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 15px; }
.timeline li:first-child { border-top: 0; }
.timeline .m { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; font-size: 14px; }
.timeline li.away { text-align: left; }
.ic { width: 18px; height: 18px; display: inline-grid; place-items: center; }
.ic.card-y::before, .ic.card-r::before { content: ''; width: 11px; height: 15px; border-radius: 2px; background: #f2c200; }
.ic.card-r::before { background: var(--loss); }
.ic svg { width: 18px; height: 18px; }
.lineup { display: flex; flex-direction: column; }
.lineup a { display: grid; grid-template-columns: 30px 34px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.lineup a:hover { background: var(--surface-2); }
.lineup .av { width: 32px; height: 32px; font-size: 13px; }
.lineup .j { font-family: var(--display); font-weight: 700; color: var(--muted); text-align: center; }
.lineup .ev { display: flex; gap: 4px; align-items: center; font-size: 13px; color: var(--muted); }
.lineup-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 0 4px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-l { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.bar-l b { font-variant-numeric: tabular-nums; }
.bar { display: flex; gap: 3px; height: 8px; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.bar .h { background: var(--night); }
.bar .a { background: #a9b4cc; }

/* ranking */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 99px; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--ink); color: #fff; border-color: var(--ink); }
.rank-list { display: flex; flex-direction: column; }
.rank-list a { display: grid; grid-template-columns: 34px 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); }
.rank-list a:first-child { border-top: 0; }
.rank-list a:hover { background: var(--surface-2); }
.rank-list .pos { font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--muted); text-align: center; }
.rank-list .val { font-family: var(--display); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-list .who b { display: block; line-height: 1.15; }
.rank-list .who small { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.rank-list .who small img { width: 16px; height: 16px; }

select { font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.loading { padding: 60px 16px; text-align: center; color: var(--muted); }
footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; font-size: 12px; color: var(--muted); }
footer a { text-decoration: underline; }

/* fichas para impressão */
.ficha { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }

/* ---------- IMPRESSÃO ---------- */
@page { size: A4; margin: 12mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 11pt; }
  .top, .no-print, footer .no-print, .seg, select, .btn { display: none !important; }
  main { max-width: none; padding: 0; gap: 14px; }
  .print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #000; padding-bottom: 4px; margin-bottom: 4px; font-size: 9pt; }
  .print-head b { font-family: var(--display); font-size: 14pt; text-transform: uppercase; }
  .panel, .pcard, .tile, .team-tile, .ficha, .match, tr, .rank-list a, .lineup a, .timeline li { break-inside: avoid; }
  section { break-inside: auto; }
  .sec-head { break-after: avoid; }
  .panel, .pcard, .tile, .team-tile, .ficha { border-color: #bbb; }
  h1 { font-size: 26pt; }
  h2 { font-size: 16pt; }
  table { font-size: 9.5pt; }
  td, th { padding: 4px 6px; }
  .table-wrap { overflow: visible; }
  .squad { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .teams-grid { grid-template-columns: repeat(6, 1fr); }
  .player { grid-template-columns: 55mm 1fr; gap: 8mm; }
  .photo { max-width: none; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .fav, .scoreboard { background: #fff !important; color: #000 !important; border: 2px solid #000; }
  .fav .logo.lg, .scoreboard .t img { background: none; }
  .ficha { break-after: page; border: 0; padding: 0; }
  .ficha:last-child { break-after: auto; }
  .match { grid-template-columns: 70px 1fr auto 1fr; }
  .match .when { grid-column: auto; display: block; }
  a[href]::after { content: none; }
  footer { padding: 8px 0 0; }
}

/* ajustes de celular */
@media (max-width: 560px) {
  .brand b { font-size: 22px; }
  .updated { font-size: 11px; text-align: right; }
  .updated .live-label { display: none; }
  nav.tabs a { padding: 10px 9px 12px; font-size: 14px; }
  .fav { grid-template-columns: 1fr; }
  .fav .logo.lg { width: 56px; height: 56px; }
  .page-head .actions { width: 100%; }
  .scoreboard .sc { font-size: 44px; }
  .scoreboard .t { font-size: 15px; }
  .scoreboard .t img, .scoreboard .t .logo { width: 52px; height: 52px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  td, th { padding: 8px 6px; }
}
.match .ta { display: none; }
@media (max-width: 400px) { .match .tn { display: none; } .match .ta { display: inline; } }
@media print { .match .ta { display: none !important; } .match .tn { display: inline !important; } }
