:root {
  --bg: #0c1118;
  --bg-soft: #131b26;
  --panel: #18222f;
  --panel-2: #1f2c3d;
  --line: #2a3a4f;
  --text: #e8eef5;
  --muted: #92a3b8;
  --green: #1db954;
  --green-dark: #128a3c;
  --gold: #f5c542;
  --accent: #3da5ff;
  --danger: #ff5d5d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #16324a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29,185,84,.08), transparent);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 34px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.brand h1 { margin: 0; font-size: clamp(18px, 3vw, 24px); }
.brand-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-meta { text-align: right; }
.countdown {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
}
.countdown .num { font-size: 22px; font-weight: 700; color: var(--gold); }
.countdown .unit { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.countdown-label { font-weight: 600; }
.updated { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- Seletor de idioma ---------- */
.lang-switcher {
  display: inline-flex;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 10px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-active { background: var(--green); color: #06240f; }
.lang-flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; display: block; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }

/* Seletor de versão (v1/v2) na aba Probabilidades */
.odds-version { display: inline-flex; gap: 6px; margin: 4px 0 14px; }
.ver-btn {
  background: transparent; border: 1px solid rgba(255, 255, 255, .14); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.ver-btn:hover { color: var(--text); }
.ver-btn.is-active { background: var(--green); color: #06240f; border-color: var(--green); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 14px clamp(16px, 4vw, 40px) 0;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: var(--panel);
}

/* ---------- Layout ---------- */
main {
  padding: 20px clamp(16px, 4vw, 40px) 60px;
  max-width: 1100px;
  margin: 0 auto;
}
.view { display: none; animation: fade .25s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 16px; font-size: 18px; }

/* ---------- Summary cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .value { font-size: 30px; font-weight: 800; color: var(--gold); }
.stat-card .label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .data-table { min-width: 480px; } /* rola na horizontal no celular em vez de espremer */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { white-space: nowrap; }

/* Barra de probabilidade de título */
.odds-bar { position: relative; display: flex; align-items: center; min-width: 84px; height: 18px; background: var(--line); border-radius: 5px; overflow: hidden; }
.odds-bar span { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--green-dark), var(--gold)); }
.odds-bar b { position: relative; z-index: 1; font-size: 11px; padding: 0 6px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table td:last-child, .data-table th:last-child { text-align: right; }
.team-cell { display: flex; align-items: center; gap: 8px; }
.crest { width: 22px; height: 22px; object-fit: contain; flex: none; }
/* Fallback quando o escudo (imagem) não carrega: mostra a sigla da seleção. */
.crest-fallback {
  width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800; letter-spacing: .2px; line-height: 1;
  color: var(--muted); background: rgba(255, 255, 255, .08); border-radius: 4px;
}

/* ---------- Mini rank ---------- */
.mini-rank { list-style: none; margin: 0; padding: 0; }
.mini-rank li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-rank li:last-child { border: none; }
.mini-rank .pos { width: 24px; font-weight: 700; color: var(--muted); }
.mini-rank .goals { margin-left: auto; font-weight: 700; color: var(--gold); }

/* ---------- Groups ---------- */
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.group-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.group-card h3 { margin: 0 0 12px; font-size: 15px; color: var(--gold); }
.group-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.group-card th, .group-card td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.group-card th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.group-card td:not(.team-name) { text-align: center; }
.qualify { border-left: 3px solid var(--green); }

/* ---------- Matches ---------- */
.match-list { display: flex; flex-direction: column; gap: 10px; }
.match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}
.match .side { display: flex; align-items: center; gap: 8px; }
.match .side.home { justify-content: flex-end; text-align: right; }
.match .center { text-align: center; min-width: 70px; }
.match .score { font-size: 20px; font-weight: 800; }
.match .time { font-size: 12px; color: var(--muted); }
.match .stage { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.badge-live { color: var(--danger); font-weight: 700; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.live-status { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: .03em; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; }

/* ---------- Notícias ---------- */
.digest-summary { margin: 0; font-size: 15px; line-height: 1.6; }
.digest-note { margin: 10px 0 0; font-size: 11px; color: var(--muted); font-style: italic; }
.digest-note::before { content: "✨ "; }
.digest-list { list-style: none; margin: 0; padding: 0; }
.digest-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.digest-item:last-child { border: none; }
.digest-dot { flex: none; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(29,185,84,.18); }
.digest-detail { color: var(--muted); font-size: 13px; margin-top: 3px; }

.news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.news-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.news-card:hover { border-color: var(--green); transform: translateY(-2px); }
.news-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.news-source { font-weight: 700; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-time { flex: none; }
.news-headline { font-size: 14px; font-weight: 600; line-height: 1.35; }

/* ---------- Calibração ---------- */
.calib { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.calib h3 { margin: 0 0 6px; font-size: 16px; }
.calib-table { max-width: 360px; margin-top: 8px; }

/* ---------- Bracket ---------- */
.bracket-head { margin-bottom: 16px; }
.bracket-head h2 { margin: 0 0 4px; }
.bracket-note { margin: 0; color: var(--muted); font-size: 13px; }
.bracket {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: stretch;
}
.bracket-col { flex: 0 0 auto; min-width: 190px; }
.bracket-col h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
}
.bracket-cells {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 10px;
  height: 100%;
}
.bm {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.bm.pending { opacity: .5; border-style: dashed; }
.bm-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; }
.bm-row + .bm-row { border-top: 1px solid var(--line); }
.bt { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.bt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt.win { font-weight: 700; color: var(--green); }
.bs { font-weight: 700; font-size: 13px; color: var(--gold); padding-left: 6px; }
.third-place { margin-top: 24px; max-width: 240px; }
.third-place h3 { font-size: 13px; color: var(--gold); text-transform: uppercase; margin: 0 0 10px; }

/* ---------- Compare ---------- */
.compare-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.team-select {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  min-width: 180px;
}
.vs { font-weight: 800; color: var(--muted); }
.compare-result { display: grid; gap: 10px; }
.compare-row { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; gap: 12px; }
.compare-row .label { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; display: flex; }
.bar .a { background: var(--accent); }
.bar .b { background: var(--gold); }
.compare-row .va { text-align: right; font-weight: 700; }
.compare-row .vb { text-align: left; font-weight: 700; }

.matches-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.matches-toolbar h2 { margin: 0; }
.matches-filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 30px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

@media (max-width: 600px) {
  .topbar-meta { text-align: left; }
  .match { grid-template-columns: 1fr auto 1fr; font-size: 13px; }
}
