/* Explorador: mapa em tela cheia + painel lateral (no celular, um embaixo do outro). */
.exp { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; padding: 16px; max-width: 1440px; margin: 0 auto; height: calc(100dvh - var(--topo-h)); }
.exp-mapa {
  position: relative; border-radius: var(--radius); min-height: 0;
  background-color: var(--bg); background-image: radial-gradient(var(--pontos) 1.2px, transparent 1.3px); background-size: 18px 18px;
  display: flex; flex-direction: column;
}
.exp-ctrl {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 99px; padding: 5px; box-shadow: var(--shadow-sm); width: fit-content; max-width: 100%; z-index: 2;
}
.seg { display: inline-flex; gap: 2px; }
.seg button { border: 0; background: none; color: var(--text); font: inherit; font-weight: 700; font-size: 14px; padding: 7px 14px; border-radius: 99px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--line-strong); color: var(--bg); }
.analise { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px 0 10px; border-left: 1px solid var(--line); font-size: 14px; color: var(--muted); font-weight: 600; }
.analise select { font: inherit; font-weight: 800; color: var(--text); border: 0; background: none; padding: 6px 2px; cursor: pointer; }
.analise select option { background: var(--card); color: var(--text); }
.exp-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; z-index: 2; }
.exp-sub:empty { display: none; }
.exp-sub > * { min-width: 0; max-width: 100%; }
.exp-sub .chips button { padding: 4px 11px; font-size: 13px; background: var(--card); }
.exp-sub .chips button[aria-selected="true"] { background: var(--line-strong); color: var(--bg); }
.exp-sub .entrada.curso { flex: 1; min-width: 0; max-width: 340px; padding: 8px 12px; border-radius: 99px; font-size: 14px; }
.exp-sub .entrada.curso + datalist + .btn-x { flex: none; }
.btn-x.peq { width: 30px; height: 30px; font-size: 13px; }
.exp-leg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; color: var(--muted); font-weight: 600; margin: 8px 0 0; z-index: 2; }
.exp-leg .esc { width: 110px; height: 10px; border-radius: 99px; background: linear-gradient(90deg, var(--map-0), var(--map-1), var(--map-2), var(--map-3), var(--map-4)); }
.exp-leg .esc.div { background: linear-gradient(90deg, var(--div-neg), var(--div-mid), var(--div-pos)); }
.exp-leg small { flex-basis: 100%; font-size: 12px; }
/* O mapa ocupa a seção inteira; controles e legenda flutuam por cima, sem fundo. */
.exp-svgbox { position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: var(--radius); touch-action: none; cursor: grab; }
.exp-sub, .exp-leg { pointer-events: none; }
.exp-sub > *, .exp-ctrl { pointer-events: auto; }
.exp-leg { text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 6px var(--bg); }
.carregando { top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }
/* O SVG ocupa a caixa inteira e o viewBox se ajusta dentro dela (cabe sempre na tela). */
#mapa { touch-action: none; cursor: grab; user-select: none; position: absolute; left: 0; right: 0; top: calc(var(--ctrl-h, 120px) + 6px); width: 100%; height: calc(100% - var(--ctrl-h, 120px) - 64px); display: block; overflow: visible; }
#mapa .relevo path { fill: var(--relevo); stroke: var(--relevo); stroke-width: 2; vector-effect: non-scaling-stroke; }
#mapa .formas path { stroke: var(--card); stroke-width: 1.5; cursor: pointer; transition: fill .45s, transform .2s; outline: none; vector-effect: non-scaling-stroke; }
#mapa .formas.mun path { stroke-width: .5; }
#mapa .formas path.vazio { fill: var(--vazio); cursor: default; }
#mapa .formas path:not(.vazio):hover, #mapa .formas path:focus-visible { transform: translateY(-4px); stroke: var(--line-strong); stroke-width: 2; }
#mapa .formas path.sel { stroke: var(--line-strong); stroke-width: 2.5; transform: translateY(-5px); filter: drop-shadow(0 6px 6px rgba(0,0,0,.25)); }
#mapa .rot { font: 700 calc(22px / var(--zoom, 1)) "Plus Jakarta Sans", system-ui, sans-serif; fill: var(--text); pointer-events: none; paint-order: stroke; stroke: var(--card); stroke-width: calc(5px / var(--zoom, 1)); stroke-linejoin: round; opacity: .9; }
#mapa .pino { fill: var(--card); stroke: var(--line-strong); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
#mapa .pino-halo { fill: var(--line-strong); opacity: .2; pointer-events: none; animation: halo 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
/* "Você": ponto cheio com aro e duas ondas de radar, pulsando devagar. */
#mapa .voce { pointer-events: none; }
#mapa .voce-ponto { fill: var(--sun); stroke: var(--line-strong); stroke-width: 2; vector-effect: non-scaling-stroke; animation: voce-brilho 2.4s ease-in-out infinite; }
#mapa .voce-aro { fill: none; stroke: var(--line-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: .8; }
#mapa .voce-onda { fill: var(--sun); stroke: var(--sun); stroke-width: 1.5; vector-effect: non-scaling-stroke; opacity: 0; transform-box: fill-box; transform-origin: center; animation: voce-onda 2.4s ease-out infinite; }
#mapa .voce-onda.dois { animation-delay: 1.2s; }
@keyframes voce-onda { 0% { transform: scale(.35); opacity: .55; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes voce-brilho { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { #mapa .voce-onda { animation: none; opacity: .25; } #mapa .voce-ponto { animation: none; } }
@keyframes halo { from { transform: scale(.6); opacity: .5; } to { transform: scale(1.4); opacity: 0; } }
@keyframes pula { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.carregando { position: absolute; color: var(--muted); font-weight: 700; }
.exp-zoom { position: absolute; left: 0; bottom: 0; display: flex; gap: 8px; }
.exp-zoom-ctrl { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; z-index: 3; }
.exp-zoom-ctrl .btn-mapa { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; }
.btn-mapa { border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 800; padding: 9px 14px; border-radius: 12px; box-shadow: var(--shadow-sm); cursor: pointer; }
.exp-busca { position: absolute; right: 0; bottom: 0; width: min(300px, calc(100% - 120px)); }
.exp-busca .entrada { border-radius: 12px; box-shadow: var(--shadow-sm); border-width: 1px; }

/* ---------- painel ---------- */
.exp-painel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-y: auto; padding: 16px 18px 24px; min-height: 0; }
.migalhas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.migalhas button { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); font-weight: 700; cursor: pointer; }
.migalhas button:disabled { color: var(--muted); cursor: default; font-weight: 600; }
.migalhas b { color: var(--text); }
.p-titulo { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.p-titulo h1 { font-size: 26px; letter-spacing: -0.6px; margin: 0; line-height: 1.15; }
.p-acoes { display: flex; gap: 6px; }
.faixa-comparar { width: 100%; border: 1.5px dashed var(--brand); background: var(--brand-soft); color: var(--brand); font: inherit; font-weight: 800; padding: 9px; border-radius: 12px; cursor: pointer; margin-bottom: 6px; }
.p-cartao { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.p-cartao.destaque { border-color: var(--brand); background: var(--card); }
.p-cartao h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; }
.p-cartao h3 { font-size: 14px; margin: 14px 0 6px; }
.p-cartao .botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mini-notas { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mini-notas div { display: grid; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; }
.mini-notas small { font-size: 11px; color: var(--muted); font-weight: 600; }
.mini-notas b { font-size: 17px; font-variant-numeric: tabular-nums; }
.barras { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.b-top { display: flex; gap: 8px; align-items: baseline; font-size: 14px; font-weight: 700; }
.b-top b { margin-left: auto; font-size: 16px; font-variant-numeric: tabular-nums; }
.b-top .delta-pos, .b-top .delta-neg { font-size: 12px; background: var(--ok-soft); border-radius: 99px; padding: 1px 8px; }
.b-top .delta-neg { background: var(--err-soft); }
.b-trilho { position: relative; height: 9px; border-radius: 99px; background: var(--brand-soft); margin-top: 4px; }
.b-este { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--brand); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.b-ref { position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--line-strong); opacity: .55; }
.posicao-rank { margin: 0 0 8px; font-size: 14px; }
.posicao-rank b { font-size: 22px; color: var(--brand); }
.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.rank button { width: 100%; display: grid; grid-template-columns: 26px minmax(0, 1fr) 70px auto; gap: 8px; align-items: center; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 6px; border-radius: 10px; cursor: pointer; text-align: left; }
.rank button:hover { background: var(--brand-soft); }
.rank .voce button { background: var(--warn-soft); font-weight: 800; }
.r-pos { color: var(--muted); font-weight: 700; font-size: 12px; text-align: right; }
.r-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.r-barra { height: 7px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.r-barra i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.rank b { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; }
.rank .sep { text-align: center; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { display: grid; background: var(--bg); border-radius: 10px; padding: 8px; }
.stats b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.stats small { font-size: 11px; color: var(--muted); font-weight: 600; line-height: 1.25; }
.lista-sisu ol { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 14px; }
.lista-sisu li { overflow: hidden; }
.lista-sisu li a { color: var(--text); text-decoration: none; font-weight: 600; }
.lista-sisu li a:hover { color: var(--brand); text-decoration: underline; }
.lista-sisu li b { float: right; font-size: 13px; color: var(--muted); margin-left: 8px; }
.p-cartao > .btn { margin-top: 12px; }
.fonte { margin-top: 14px; }
.comp { width: 100%; border-collapse: collapse; font-size: 14px; }
.comp th, .comp td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.comp th:first-child { text-align: left; }
.comp thead th { vertical-align: bottom; font-size: 13px; }
.comp thead th span { display: block; white-space: normal; }
.comp td.melhor { font-weight: 800; color: var(--ok); }
.mini-x { width: 22px; height: 22px; font-size: 11px; margin-top: 4px; }

@media (max-width: 960px) {
  .exp { grid-template-columns: minmax(0, 1fr); height: auto; padding: 12px 16px; }
  .exp-mapa { height: 68dvh; min-height: 440px; }
  .exp-painel { overflow: visible; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .exp-ctrl { border-radius: 16px; }
  .analise { border-left: 0; padding-left: 4px; }
}
@media (max-width: 420px) {
  .mini-notas { grid-template-columns: repeat(3, 1fr); }
  .rank button { grid-template-columns: 22px minmax(0, 1fr) 44px auto; }
}

.exp-sub .chips.anos { gap: 4px; flex-basis: 100%; }
.exp-sub .chips.anos button { padding: 3px 9px; font-size: 12px; }
.mini-tab { font-size: 12px; }
.mini-tab th, .mini-tab td { padding: 4px 3px; }
