@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --ink: #1b1440;
  --ink-2: #4d4a63;
  --muted: #6f6d88;
  --grid: #e6e8f0;
  --axis: #cfd2de;
  --border: rgba(27, 20, 64, 0.08);
  --blue: #1d71b8;
  --track: #dbe7f4;
  --gold: #b87a00;
  --navy: #211452;
  --shadow: 0 1px 2px rgba(27, 20, 64, 0.04), 0 8px 24px rgba(27, 20, 64, 0.05);
  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0a24;
    --surface: #171233;
    --ink: #ffffff;
    --ink-2: #c5c2dd;
    --muted: #9591b3;
    --grid: #2a2450;
    --axis: #3a3468;
    --border: rgba(255, 255, 255, 0.09);
    --blue: #4a9be0;
    --track: #2a2450;
    --gold: #bf8410;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0a24;
  --surface: #171233;
  --ink: #ffffff;
  --ink-2: #c5c2dd;
  --muted: #9591b3;
  --grid: #2a2450;
  --axis: #3a3468;
  --border: rgba(255, 255, 255, 0.09);
  --blue: #4a9be0;
  --track: #2a2450;
  --gold: #bf8410;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; }

.logo-escuro { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-claro { display: none; }
  :root:not([data-theme="light"]) .logo-escuro { display: block; }
}
:root[data-theme="dark"] .logo-claro { display: none; }
:root[data-theme="dark"] .logo-escuro { display: block; }

.demo-banner {
  background: var(--navy);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 16px;
}

.topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; }
.brand .logo { height: 44px; width: auto; }
.titulo h1 {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.titulo p { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.acoes { display: flex; align-items: center; gap: 10px; }
.atualizado { color: var(--muted); font-size: 13px; margin-right: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.btn:hover { border-color: var(--axis); }
.btn:focus-visible, summary:focus-visible, .rk-linha:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn-primario {
  background: var(--blue);
  color: #fff;
  border-color: transparent;
  padding: 0 16px;
}
.btn-primario:hover { filter: brightness(1.06); border-color: transparent; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px 48px;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card h2 { font-size: 18px; font-weight: 800; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.rotulo { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }

.grid2 {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
}
.grid2 > .card { display: flex; flex-direction: column; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 32px;
}
.hero-num {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 4px;
  line-height: 1;
}
.hero-num #heroTotal {
  font-size: 96px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.hero-meta { font-size: 36px; font-weight: 800; color: var(--muted); }
.hero-msg { margin-top: 10px; font-size: 18px; font-weight: 700; color: var(--ink-2); }
.hero-msg b { color: var(--ink); font-weight: 900; }

.hero-dir { display: grid; gap: 12px; align-content: start; }
.tile {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.tile-val { font-size: 34px; font-weight: 900; line-height: 1.1; margin-top: 2px; }
.tile-val small { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.tile-sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

.tile-periodo .tile-val small { font-size: 14px; }
.per-dias { display: flex; gap: 3px; margin-top: 12px; }
.per-dias i { flex: 1; height: 8px; border-radius: 3px; background: var(--track); }
.per-dias i.on { background: var(--blue); }
.per-dias i.hoje { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--blue); }
.per-datas { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 700; }
.per-datas span { display: flex; flex-direction: column; }
.per-datas .dir { text-align: right; }
.per-datas b { color: var(--ink); font-size: 14px; font-weight: 800; }
.per-datas small { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Grade de 300 pontos ---------- */
.dots {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(25, minmax(0, 1fr)) 76px;
  gap: 5px;
  align-items: center;
}
.dot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--track);
}
.dot.on { background: var(--blue); }
.dot.now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--blue); }
.marco {
  position: relative;
  height: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}
.marco-in {
  position: absolute;
  left: 8px;
  top: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}
.marco.ok { color: var(--ink); }
.marco svg { flex: none; }

/* ---------- Ranking ---------- */
.ranking { margin-top: 22px; display: grid; gap: 10px; }
.rk-linha {
  display: grid;
  grid-template-columns: 40px 160px 1fr;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: default;
}
.rk-linha:hover { background: var(--bg); }
.rk-pos { font-weight: 800; font-size: 18px; color: var(--muted); text-align: right; }
.rk-linha.top .rk-pos { color: var(--ink); }
.rk-nome { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-barra { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rk-fill {
  height: 30px;
  border-radius: 0 6px 6px 0;
  background: var(--blue);
  width: calc((100% - 150px) * var(--w));
  min-width: 4px;
  flex: none;
  transition: width 0.5s ease;
}
.rk-linha.lider .rk-fill { background: var(--gold); }
.rk-val { font-weight: 900; font-size: 18px; }
.rk-tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.rk-tag::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
}

.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--axis);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  min-width: 150px;
}
.tooltip .tt-tit { color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row + .tt-row { margin-top: 4px; }
.tooltip .tt-esq { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tooltip .tt-val { font-weight: 900; font-size: 15px; color: var(--ink); }
.tooltip .chave { width: 14px; }

/* ---------- Feed ---------- */
.feed { margin-top: 14px; display: grid; gap: 2px; }
.feed li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--grid);
}
.feed li:first-child { border-top: 0; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--track);
  color: var(--blue);
  display: grid; place-items: center;
  font-weight: 900;
}
.feed .quem { font-weight: 800; }
.feed .por { color: var(--ink-2); font-size: 13px; }
.feed .quando { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- Regras ---------- */
.regras { margin-top: 14px; display: grid; gap: 12px; }
.regras li {
  padding-left: 18px;
  position: relative;
  color: var(--ink-2);
}
.regras li::before {
  content: "";
  position: absolute; left: 0; top: 0.6em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue);
}
.regras strong { color: var(--ink); }
.aviso {
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Tabelas ---------- */
.tabelas summary { cursor: pointer; font-weight: 800; }
.tabelas-grid { margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; font-weight: 800; padding-bottom: 8px; }
th, td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--grid); }
th { color: var(--muted); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .grid2, .tabelas-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-dir { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .titulo h1 { font-size: 26px; }
  .acoes { flex-wrap: wrap; }
  .atualizado { width: 100%; margin: 0; }
  .wrap { padding: 8px 16px 40px; gap: 16px; }
  .card { padding: 18px; border-radius: 16px; }
  .hero-num #heroTotal { font-size: 72px; }
  .hero-meta { font-size: 28px; }
  .hero-dir { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile-periodo { grid-column: 1 / -1; }
  .tile { padding: 10px 12px; }
  .tile-val { font-size: 26px; }
  .tile-val small { font-size: 12px; }
  .tile-sub { font-size: 12px; }
  .dots { grid-template-columns: repeat(25, minmax(0, 1fr)) 52px; gap: 3px; }
  .marco { font-size: 11px; }
  .marco-in { left: 4px; }
  .rk-linha { grid-template-columns: 24px 90px 1fr; gap: 10px; padding: 8px 8px; }
  .rk-pos, .rk-nome, .rk-val { font-size: 15px; }
  .rk-fill { height: 24px; width: calc((100% - 56px) * var(--w)); }
  .rk-tag { display: none; }
}

/* ---------- Card de compartilhamento (exportado em PNG) ---------- */
.share-stage { position: fixed; left: -12000px; top: 0; pointer-events: none; }
.share {
  width: 1080px;
  height: 1350px;
  padding: 60px 72px 52px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fff;
  font-family: "Nunito", system-ui, sans-serif;
  background: linear-gradient(165deg, #211452 0%, #271d67 50%, #1b4a8f 130%);
}
.sh-top { display: flex; justify-content: space-between; align-items: center; }
.sh-top img { height: 64px; width: auto; }
.sh-data { font-size: 24px; font-weight: 700; color: #c5c2dd; }
.sh-titulo { margin-top: 40px; font-size: 84px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; }
.sh-sub { margin-top: 10px; font-size: 30px; font-weight: 700; color: #c5c2dd; }
.sh-periodo { margin-top: 8px; font-size: 24px; font-weight: 700; color: #b3b0d0; }
.sh-num { margin-top: 30px; display: flex; align-items: baseline; gap: 18px; line-height: 1; }
.sh-num b { font-size: 170px; font-weight: 900; letter-spacing: -0.04em; }
.sh-num span { font-size: 60px; font-weight: 800; color: #8f8bb5; }
.sh-faltam {
  margin-top: 22px;
  align-self: flex-start;
  background: #f2b632;
  color: #211452;
  font-weight: 900;
  font-size: 36px;
  padding: 12px 28px;
  border-radius: 999px;
}
.sh-dots {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 6px;
}
.sh-dots i { aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.16); }
.sh-dots i.on { background: #4a9be0; }
.sh-rank { margin-top: 30px; display: grid; gap: 10px; }
.sh-linha { display: grid; grid-template-columns: 48px 210px 1fr; align-items: center; gap: 16px; font-size: 30px; font-weight: 800; }
.sh-linha .p { color: #8f8bb5; text-align: right; }
.sh-linha .b { display: flex; align-items: center; gap: 14px; }
.sh-linha .b i { height: 26px; border-radius: 0 6px 6px 0; background: #4a9be0; width: calc((100% - 90px) * var(--w)); flex: none; }
.sh-linha.lider .b i { background: #f2b632; }
.sh-linha .v { font-weight: 900; }
.sh-rodape { margin-top: auto; padding-top: 20px; font-size: 28px; font-weight: 800; color: #c5c2dd; text-align: center; }
.sh-rodape b { color: #fff; }
