/* Base de todas as páginas: tokens, topo, componentes e gamificação. */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #5e5d66;
  --line: #e3e1da;
  --line-strong: #1b1b1f;
  /* Estudo de cores (ver README, "Visual"): roxo = saber e concentração, fora do eixo
     azul × vermelho das eleições; amarelo de marca-texto = atenção; laranja = energia;
     verde só para acerto e WhatsApp. Mapas nunca usam azul nem vermelho. */
  --brand: #6a35b0;
  --brand-ink: #ffffff;
  --brand-soft: #f1eafb;
  --sun: #ffd84a;
  --mint: #2aa984;
  --pink: #d9486f;
  --ok: #13804f;
  --ok-soft: #e1f4ea;
  --err: #c8323f;
  --err-soft: #fbe7e8;
  --warn: #7a5300;
  --warn-soft: #fff5d6;
  --whats: #1fa855;
  --map-0: #f2edf8;
  --map-1: #d4c2ea;
  --map-2: #a98ad4;
  --map-3: #7a53b6;
  --map-4: #4a2483;
  /* Divergente (caiu ↔ subiu) para "evolução": laranja ↔ roxo, seguro para daltonismo. */
  --div-neg: #d9741c; --div-mid: #f1efe9; --div-pos: #6a35b0;
  --relevo: #cfccc2;
  --pontos: rgba(27, 27, 31, .08);
  /* Séries do gráfico (Brasil, estado, cidade): validadas para daltonismo no claro e no escuro. */
  --s1: #6a35b0; --s2: #e07a1f; --s3: #1d8f6e;
  --vazio: #e7e5df;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 27, 31, .05), 0 6px 20px -12px rgba(27, 27, 31, .18);
  --shadow-sm: 0 1px 2px rgba(27, 27, 31, .05), 0 4px 14px -8px rgba(27, 27, 31, .16);
  --serifa: "Newsreader", Georgia, "Times New Roman", serif;
  --topo-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121316; --card: #1b1c20; --text: #f1f0ec; --muted: #a4a3ab; --line: #2d2e34; --line-strong: #f1f0ec;
    --brand: #b691ff; --brand-ink: #121316; --brand-soft: #2a2140;
    --ok: #4fd18f; --ok-soft: #14301f; --err: #ff7f88; --err-soft: #3a1c20; --warn: #ffd166; --warn-soft: #33290f;
    --map-0: #251d33; --map-1: #3f2d63; --map-2: #6447a0; --map-3: #9675d6; --map-4: #cdb6ff;
    --div-neg: #ff9d4d; --div-mid: #26272c; --div-pos: #b691ff;
    --relevo: #050506; --pontos: rgba(241, 240, 236, .07);
    --s1: #a27ae6; --s2: #e8873a; --s3: #2bb389; --vazio: #2a2b30;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px -12px rgba(0,0,0,.6);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px -8px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg: #121316; --card: #1b1c20; --text: #f1f0ec; --muted: #a4a3ab; --line: #2d2e34; --line-strong: #f1f0ec;
  --brand: #b691ff; --brand-ink: #121316; --brand-soft: #2a2140;
  --ok: #4fd18f; --ok-soft: #14301f; --err: #ff7f88; --err-soft: #3a1c20; --warn: #ffd166; --warn-soft: #33290f;
  --map-0: #251d33; --map-1: #3f2d63; --map-2: #6447a0; --map-3: #9675d6; --map-4: #cdb6ff;
  --div-neg: #ff9d4d; --div-mid: #26272c; --div-pos: #b691ff;
  --relevo: #050506; --pontos: rgba(241, 240, 236, .07);
  --s1: #a27ae6; --s2: #e8873a; --s3: #2bb389; --vazio: #2a2b30;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px -12px rgba(0,0,0,.6);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px -8px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden;
  font: 16px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
h1, h2, .serifa { font-family: var(--serifa); font-weight: 600; letter-spacing: -0.3px; }
img, svg { max-width: 100%; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.wrap.largo { max-width: 1180px; }
.wrap.medio { max-width: 1000px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- topo ---------- */
.barra {
  position: sticky; top: 0; z-index: 30; height: var(--topo-h);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.barra-in { display: flex; align-items: center; gap: 18px; height: 100%; padding: 0 16px; max-width: 1440px; margin: 0 auto; }
.marca { font: 600 25px/1 var(--serifa); letter-spacing: -0.4px; color: var(--text); text-decoration: none; display: inline-flex; align-items: baseline; flex: none; }
.marca span:last-child { color: inherit; font-style: italic; }
.logo-bolha { display: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 10px; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: none; box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
.contagem-topo { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; }
.hud {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 99px; padding: 4px 12px 4px 4px; font: inherit; cursor: pointer; flex: none; transition: border-color .15s, transform .1s;
}
.hud:hover { border-color: var(--brand); }
.hud:active { transform: scale(.97); }
.hud-nv { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line-strong); color: var(--bg); font-size: 13px; font-weight: 800; }
.hud-txt { display: grid; line-height: 1.1; text-align: left; }
.hud-txt b { font-size: 13px; }
.hud-txt small { font-size: 11px; color: var(--muted); font-weight: 600; }
.hud-barra { display: block; width: 54px; height: 7px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.hud-barra i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.hud-barra.grande { width: 100%; height: 12px; margin: 10px 0 4px; }
.hud-seq { font-size: 13px; font-weight: 800; }
@media (max-width: 860px) {
  .barra { height: auto; }
  .barra-in { flex-wrap: wrap; gap: 6px 10px; padding: 8px 16px 0; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px 6px; }
  .nav a { font-size: 14px; padding: 6px 10px; }
  .contagem-topo { margin-left: auto; }
  .hud-barra, .hud-txt small { display: none; }
}
@media (max-width: 420px) { .contagem-topo { display: none; } .hud { margin-left: auto; } }

/* ---------- componentes ---------- */
.cartao { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px 18px; margin: 18px 0; box-shadow: var(--shadow); }
.cartao h2 { font-size: 24px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.dica, .mini { color: var(--muted); font-size: 14px; }
.mini { font-size: 13px; }
.rotulo { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px;
  padding: 6px 13px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform .12s;
  text-decoration: none;
}
.chips button:active { transform: scale(.94); }
.chips button[aria-pressed="true"], .chips button[aria-selected="true"] { border-color: var(--line-strong); background: var(--line-strong); color: var(--bg); font-weight: 700; }
.select, .entrada { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--text); width: 100%; }
.select:focus, .entrada:focus { border-color: var(--brand); outline: none; }
.btn {
  display: inline-block; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn.fantasma { background: var(--card); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; font-weight: 700; }
.btn.peq { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.aviso { font-size: 13px; color: var(--muted); background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; }
.pilula { display: inline-block; background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; padding: 3px 11px; font-size: 13px; font-weight: 600; color: var(--muted); }
.delta-pos { color: var(--ok); font-weight: 800; }
.delta-neg { color: var(--err); font-weight: 800; }

.conquistas { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.conquista {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 5px 13px 5px 5px;
  background: var(--card); border: 2px solid var(--sun); font-weight: 700; font-size: 13px; animation: entra .5s cubic-bezier(.2,1.4,.4,1) both;
}
.conquista .ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sun); font-size: 15px; }
.conquista.bloq { border-color: var(--line); color: var(--muted); animation: none; }
.conquista.bloq .ic { background: var(--vazio); }
@keyframes entra { from { opacity: 0; transform: translateY(10px) scale(.8); } }

/* ---------- missões (gaveta) ---------- */
.gaveta-fundo { position: fixed; inset: 0; background: rgba(15, 12, 34, .45); z-index: 60; display: flex; justify-content: flex-end; animation: fade .2s; }
.gaveta {
  width: min(420px, 100%); height: 100%; overflow-y: auto; background: var(--card); padding: 20px 18px 30px;
  box-shadow: -12px 0 40px rgba(0,0,0,.2); animation: desliza .3s cubic-bezier(.2,.8,.2,1);
}
.gaveta-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.gaveta-topo > div { display: grid; }
.gaveta-topo b { font-size: 19px; }
.gaveta-topo small { color: var(--muted); font-weight: 600; font-size: 13px; }
.nv-grande { font-size: 34px; }
.gaveta h3 { margin: 20px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.gaveta .seq { font-weight: 700; margin: 8px 0 0; }
.btn-x { border: 0; background: var(--brand-soft); color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer; flex: none; }
.missoes { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.missoes li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 12px; }
.missoes li.ok { background: var(--ok-soft); border-color: transparent; }
.m-ic { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.missoes li.ok .m-ic { background: var(--ok); border-color: var(--ok); }
.m-txt { flex: 1; font-weight: 600; font-size: 14px; display: grid; }
.m-txt small { color: var(--muted); font-weight: 600; font-size: 12px; }
.missoes b { font-size: 13px; color: var(--brand); }
.gaveta-fundo.centro { justify-content: center; align-items: center; padding: 16px; }
.gaveta.modal { height: auto; max-height: calc(100% - 32px); border-radius: var(--radius); }
.slider { display: grid; gap: 2px; margin: 14px 0; font-weight: 700; font-size: 14px; }
.slider > span { display: flex; align-items: baseline; gap: 4px; }
.slider small { color: var(--muted); font-weight: 600; }
.slider b { margin-left: auto; font-size: 18px; font-variant-numeric: tabular-nums; }
.slider input { width: 100%; accent-color: var(--brand); height: 26px; }
@keyframes fade { from { opacity: 0; } }
@keyframes desliza { from { transform: translateX(40px); opacity: 0; } }

/* ---------- toasts e confete ---------- */
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--line-strong); color: var(--bg); border-radius: 99px;
  padding: 8px 16px 8px 8px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-sm); animation: sobe .35s cubic-bezier(.2,1.4,.4,1);
}
.toast b { background: var(--sun); color: #1b1b1f; border-radius: 99px; padding: 2px 10px; font-size: 13px; }
.toast.conq b { background: var(--pink); }
.toast.sai { opacity: 0; transform: translateY(10px); transition: all .4s; }
@keyframes sobe { from { opacity: 0; transform: translateY(16px) scale(.9); } }
#confete { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* ---------- rodapé ---------- */
.rodape { color: var(--muted); font-size: 14px; padding: 26px 0 40px; border-top: 1px solid var(--line); margin-top: 30px; }
.rodape a { color: var(--muted); }
.rodape .links { display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* ---------- minhas metas ---------- */
.btn-metas {
  display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line-strong); background: var(--sun); color: #1b1b1f;
  border-radius: 99px; padding: 6px 14px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; flex: none; white-space: nowrap;
}
.btn-metas:hover { filter: brightness(1.04); }
.btn-metas .alvo { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; box-shadow: inset 0 0 0 3px var(--sun), inset 0 0 0 7px currentColor; }
.meta-sec { border-top: 1px solid var(--line); padding: 14px 0 6px; margin-top: 12px; scroll-margin-top: 10px; }
.meta-sec h3 { margin: 0 0 8px !important; color: var(--text) !important; font-size: 16px !important; text-transform: none !important; letter-spacing: 0 !important; }
.meta-busca { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }
.meta-card { display: grid; gap: 2px; background: var(--warn-soft); border: 1.5px solid var(--sun); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.meta-card small { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.meta-card span { font-size: 13px; color: var(--muted); }
.btn-link { justify-self: start; border: 0; background: none; padding: 0; color: var(--err); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.meta-opcoes { display: grid; gap: 6px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.meta-op { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; text-align: left; border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.meta-op:hover { border-color: var(--brand); }
.meta-op span { color: var(--muted); font-size: 13px; }
.meta-op em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- compartilhar ---------- */
.compartilhar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-whats {
  display: inline-flex; align-items: center; gap: 8px; background: var(--whats); color: #fff; border-radius: 10px;
  padding: 9px 16px; font-weight: 700; text-decoration: none; font-size: 15px; transition: filter .15s;
}
.btn-whats:hover { filter: brightness(1.08); }
.btn-whats svg { width: 20px; height: 20px; }
@media (max-width: 860px) { .btn-metas { order: 1; margin-left: auto; } .hud { order: 2; } }
@media (max-width: 420px) { .btn-metas { padding: 5px 10px; font-size: 13px; } .hud { margin-left: 0; padding: 3px; } .hud-txt { display: none; } }

/* ---------- dica flutuante e gráfico ---------- */
.mapa-tip {
  position: absolute; pointer-events: none; background: var(--line-strong); color: var(--bg); border-radius: 12px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; width: max-content; max-width: 240px; min-width: 150px;
  transform: translate(-50%, calc(-100% - 12px)); z-index: 5; line-height: 1.4;
}
.mapa-tip b { font-size: 14px; display: block; }
.grafico-box { position: relative; max-width: 620px; }
.grafico { width: 100%; height: auto; display: block; overflow: visible; }
.g-grade { stroke: var(--line); stroke-width: 1; }
.g-eixo { fill: var(--muted); font: 600 10px "Plus Jakarta Sans", system-ui, sans-serif; }
.g-serie { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.g-rot { fill: var(--text); font: 700 11px "Plus Jakarta Sans", system-ui, sans-serif; }
.g-voce { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
.g-voce-txt { fill: var(--text); font: 800 10px "Plus Jakarta Sans", system-ui, sans-serif; }
.g-mira { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tabela-rolagem { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Minhas metas: rodapé fixo (salva na hora) e a nota ponderada do objetivo. */
.gaveta-rodape { position: sticky; bottom: -30px; margin: 18px -18px -30px; z-index: 2; padding: 12px 18px; background: var(--card); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gaveta-rodape small { color: var(--muted); font-weight: 600; font-size: 13px; }
.meta-salvo { margin: 4px 0 0; min-height: 1.4em; font-size: 13px; font-weight: 700; color: var(--ok); }
.meta-pond { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 8px 0 4px; padding: 8px 10px; background: var(--card); border-radius: 10px; }
.meta-pond span { flex-basis: 100%; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.meta-pond b { font-family: var(--serifa); font-size: 30px; line-height: 1; }
.meta-pond em { font-style: normal; font-weight: 700; color: var(--warn); }
.meta-pond em.ok { color: var(--ok); }
/* Objetivo amplo (só o curso, ou curso + estado): ocupa a linha toda e vem destacado. */
.meta-op.amplo { grid-template-columns: 1fr auto; border-color: var(--brand); background: var(--brand-soft); }
.meta-op.amplo span { grid-column: 1; grid-row: 2; }
.meta-op.amplo em { grid-row: 1 / span 2; align-self: center; font-size: 13px; }
.meta-opcoes .mini { margin: 6px 0 0; }
.meta-card .btn.peq { justify-self: start; margin: 6px 0 2px; }

/* Sugerir melhoria */
.btn-link-sec { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 6px 2px; justify-self: start; }
.btn-link-sec:hover { color: var(--text); }
.btn-link-sec.sugerir { display: inline-block; margin-top: 10px; }
.sug-form { display: grid; gap: 10px; margin-top: 14px; }
.sug-form textarea { resize: vertical; min-height: 110px; font: inherit; }

/* Enquete (palpite do tema da redação) */
.enquete { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; box-shadow: var(--shadow-sm); }
.enquete h3 { margin: 0 0 12px; font-size: 21px; line-height: 1.25; }
.enq-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.enq-op { text-align: left; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); border-radius: 12px; padding: 10px 12px; font: inherit; font-weight: 700; cursor: pointer; }
.enq-op:hover:not(:disabled) { border-color: var(--brand); }
.enq-res { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.enq-res li { display: grid; grid-template-columns: minmax(0, 1fr) 40% 44px; gap: 10px; align-items: center; font-size: 14px; }
.enq-res li.meu .enq-rot { font-weight: 800; }
.enq-rot small { color: var(--brand); font-weight: 700; }
.enq-barra { height: 10px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.enq-barra i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.enq-res li.meu .enq-barra i { background: var(--sun); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.enq-res b { text-align: right; font-variant-numeric: tabular-nums; }
[data-canal]:empty { display: none; }
[data-canal] { margin: 12px 0; }
@media (max-width: 560px) { .enq-res li { grid-template-columns: minmax(0, 1fr) 30% 40px; } }
