:root {
  --tinta: #13213c;
  --dourado: #ffc93c;
  --vermelho: #d7263d;
  --azul: #3c3b6e;
  --ceu: #bfe0f2;
  --horizonte: #eef6fa;
  --papel: #ffffff;
  --cinza: #5f6b7a;
  --sombra: 0 10px 30px rgba(19, 33, 60, 0.22);
  --borda: 4px solid var(--tinta);
  --raio: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: linear-gradient(180deg, var(--ceu), var(--horizonte)); font-family: Archivo, system-ui, sans-serif; color: var(--tinta); -webkit-tap-highlight-color: transparent; }
#mapa { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#etiquetas { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#corte { position: fixed; inset: 0; background: var(--horizonte); opacity: 0; pointer-events: none; transition: opacity .28s; z-index: 3; }
#corte.on { opacity: 1; }
button { font-family: inherit; cursor: pointer; }

/* ---------- topo e busca */
#topo { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); z-index: 5; }
.marca { text-align: center; font-weight: 900; font-size: 22px; letter-spacing: .2px; margin-bottom: 6px; color: white; -webkit-text-stroke: 5px var(--tinta); paint-order: stroke fill; }
.marca b { color: var(--dourado); }
#busca { display: flex; gap: 8px; background: var(--papel); border: var(--borda); border-radius: 999px; padding: 6px 6px 6px 18px; box-shadow: var(--sombra); }
#busca input { flex: 1; border: 0; outline: 0; font: 800 16px Archivo, sans-serif; min-width: 0; background: transparent; color: var(--tinta); }
#busca button { border: 3px solid var(--tinta); background: var(--dourado); color: var(--tinta); font-weight: 900; border-radius: 999px; padding: 6px 16px; font-size: 15px; }
#resultados { margin-top: 8px; background: var(--papel); border: var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; max-height: 50vh; overflow-y: auto; }
#resultados button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; border: 0; border-bottom: 2px solid #eee; background: white; padding: 11px 16px; font-size: 16px; font-weight: 800; text-align: left; color: var(--tinta); }
#resultados button:last-child { border-bottom: 0; }
#resultados small { color: var(--cinza); font-weight: 700; text-align: right; }
#resultados .vazio { padding: 14px 16px; color: var(--cinza); font-weight: 700; }

/* ---------- controles */
#controles { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 4; }
#controles button { width: 46px; height: 46px; border-radius: 50%; border: var(--borda); background: white; font-size: 24px; font-weight: 900; color: var(--tinta); box-shadow: var(--sombra); }

/* ---------- Alasca e Havaí (painéis próprios) */
#paineis-mini { position: fixed; left: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; gap: 8px; z-index: 4; }
#paineis-mini button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: var(--borda); border-radius: 14px; background: rgba(255,255,255,.88); padding: 6px 8px 4px; font-weight: 900; font-size: 12px; color: var(--tinta); box-shadow: var(--sombra); }
#paineis-mini svg { width: 64px; height: 38px; }
#paineis-mini svg path { fill: #8fc46b; stroke: var(--tinta); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
#paineis-mini button[data-painel="c"] span { font-size: 14px; padding: 6px 4px; }
#paineis-mini button[hidden] { display: none; }

/* ---------- painel (folha de baixo) */
#painel { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(64px + env(safe-area-inset-bottom)); width: min(520px, calc(100vw - 32px)); max-height: 62vh; overflow-y: auto; background: var(--papel); border: var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 18px 18px 16px; z-index: 6; }
#painel .fechar { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--tinta); background: white; font-size: 22px; font-weight: 900; line-height: 1; }
#painel h2 { margin: 0 44px 2px 0; font-size: 26px; font-weight: 900; line-height: 1.1; word-break: break-word; }
#painel h3 { margin: 16px 0 4px; font-size: 18px; font-weight: 900; }
#painel .sub { color: var(--cinza); font-weight: 700; margin-bottom: 12px; }
.selo { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 14px; letter-spacing: .6px; padding: 4px 12px; border: 3px solid var(--tinta); border-radius: 12px; background: var(--dourado); margin: 0 6px 8px 0; }
.selo.cinza { background: #e5e7eb; }
.selo.uf { background: var(--azul); color: white; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
.numeros div { border: 3px solid var(--tinta); border-radius: 14px; text-align: center; padding: 8px 4px 6px; }
.numeros b { display: block; font-size: 20px; font-weight: 900; }
.numeros span { font-size: 12px; color: var(--cinza); font-weight: 700; }
.linha { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 2px solid #f0f0f0; font-weight: 700; }
.linha span:first-child { color: var(--cinza); }
.linha span:last-child { text-align: right; }
.barra { height: 14px; border: 3px solid var(--tinta); border-radius: 999px; overflow: hidden; margin: 6px 0 12px; }
.barra i { display: block; height: 100%; background: var(--dourado); }
.botoes { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.botoes button, .botoes a { flex: 1; text-align: center; text-decoration: none; border: 3px solid var(--tinta); background: var(--dourado); border-radius: 999px; padding: 10px; font-weight: 900; font-size: 15px; color: var(--tinta); }
.botoes .sec { background: white; }
ol.ranking { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: r; }
ol.ranking li { counter-increment: r; display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 2px solid #f0f0f0; font-weight: 800; }
ol.ranking li::before { content: counter(r); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--tinta); background: var(--dourado); font-weight: 900; font-size: 14px; flex-shrink: 0; }
ol.ranking li span { flex: 1; }
ol.ranking li small { color: var(--cinza); }
ol.ranking li button { border: 3px solid var(--tinta); background: white; border-radius: 999px; padding: 4px 10px; font-weight: 900; font-size: 13px; color: var(--tinta); }
.subabas { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.subabas button { border: 3px solid var(--tinta); background: white; border-radius: 999px; padding: 5px 12px; font-weight: 900; font-size: 13px; color: var(--tinta); }
.subabas button.ativa { background: var(--dourado); }
.grande { font-size: 46px; font-weight: 900; line-height: 1; }
.nota { font-size: 13px; color: var(--cinza); font-weight: 600; margin-top: 10px; line-height: 1.4; }

/* ---------- negócios patrocinados (camada separada das casas) */
.patrocinado { border: 3px dashed var(--tinta); border-radius: 16px; padding: 10px 12px; margin: 8px 0; background: #fffdf4; }
.patrocinado .tag { display: inline-block; font-size: 11px; font-weight: 900; letter-spacing: 1px; background: var(--tinta); color: white; border-radius: 6px; padding: 2px 7px; margin-bottom: 4px; }
.patrocinado b { font-size: 17px; }
.patrocinado p { margin: 4px 0; font-weight: 600; }
.patrocinado .acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.patrocinado .acoes a { font-weight: 900; font-size: 13px; color: var(--tinta); border: 2px solid var(--tinta); border-radius: 999px; padding: 4px 10px; text-decoration: none; }

/* ---------- poder (us-regra-2.0): cargo, meta, contagem, President, guerra de estados */
.selo.cargo { background: var(--tinta); color: var(--dourado); } /* cargo: nunca vermelho nem azul (cores de partido nos EUA) */
.meta { border: 3px solid var(--tinta); border-radius: 14px; background: #fff6d6; padding: 9px 12px; font-weight: 800; margin: 0 0 8px; }
.meta a { font-weight: 900; }
.cuenta { text-align: center; border: var(--borda); border-radius: 16px; background: var(--dourado); padding: 10px 6px 8px; margin: 6px 0 4px; }
.cuenta span { display: block; font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; }
.cuenta small { font-weight: 800; font-size: 13px; }
.presidente { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; border: 3px solid var(--tinta); border-radius: 14px; padding: 10px 12px; }
.presidente b { font-size: 22px; font-weight: 900; word-break: break-all; }
.presidente span { flex: 1 1 100%; color: var(--cinza); font-weight: 800; }
.presidente button { border: 3px solid var(--tinta); background: var(--dourado); border-radius: 999px; padding: 4px 12px; font-weight: 900; color: var(--tinta); }
.guerra button { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; width: 100%; border: 0; border-bottom: 2px solid #f0f0f0; background: white; padding: 6px 0; text-align: left; font-weight: 800; font-size: 14px; color: var(--tinta); }
.guerra button i { grid-column: 1 / -1; display: block; height: 10px; border: 2px solid var(--tinta); border-radius: 999px; background: #e5e7eb; }
.guerra button:first-child i { background: var(--dourado); } /* sem vermelho/azul: "red state × blue state" */
.guerra button small { font-weight: 900; }
.linha.senado span:last-child { text-align: right; font-size: 13px; }
.composicao h3 { font-size: 15px !important; }
.etq-casa.com-cargo { border-color: var(--tinta); }
.etq-casa small em { font-style: normal; color: var(--tinta); font-weight: 900; }

/* ---------- abas e rodapé */
#abas { position: fixed; bottom: calc(26px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: white; border: var(--borda); border-radius: 999px; padding: 5px; box-shadow: var(--sombra); z-index: 5; }
#abas button { border: 0; background: transparent; border-radius: 999px; padding: 7px 13px; font-weight: 900; font-size: 14px; color: var(--tinta); white-space: nowrap; }
#abas button.ativa { background: var(--dourado); }
#rodape { position: fixed; bottom: max(4px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--tinta); opacity: .8; z-index: 4; padding: 0 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rodape a { color: var(--tinta); }
#aviso-demo { position: fixed; top: 0; left: 0; right: 0; z-index: 7; text-align: center; background: var(--vermelho); color: white; font-weight: 900; font-size: 13px; padding: 4px 8px; letter-spacing: .4px; }
#aviso-demo:not([hidden]) ~ #topo { top: max(28px, calc(env(safe-area-inset-top) + 20px)); }

/* ---------- etiquetas sobre o mapa */
.etq-casa { position: absolute; transform: translate(-50%, -100%); background: white; border: 3px solid var(--tinta); border-radius: 999px; padding: 3px 11px 2px; font-weight: 900; font-size: 13px; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,.18); pointer-events: auto; cursor: pointer; }
.etq-casa small { display: block; font-size: 10px; color: var(--cinza); font-weight: 700; margin-top: -2px; text-align: center; }
.etq-casa.fundador { background: var(--dourado); }
.etq-casa.voce { outline: 4px solid var(--vermelho); }
.etq-cidade { position: absolute; transform: translate(-50%, -130%); font-weight: 900; font-size: 13px; white-space: nowrap; color: white; -webkit-text-stroke: 4px var(--tinta); paint-order: stroke fill; pointer-events: auto; cursor: pointer; }
.etq-cidade small { color: var(--dourado); }

/* ---------- carregando */
#carregando { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; z-index: 9; background: linear-gradient(180deg, var(--ceu), var(--horizonte)); font-weight: 900; font-size: 18px; transition: opacity .4s; }
#carregando .bola { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; border: 6px solid var(--tinta); border-top-color: var(--dourado); animation: gira 0.9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (max-width: 420px) {
  #abas button { padding: 7px 9px; font-size: 13px; }
  .numeros b { font-size: 17px; }
  #paineis-mini svg { width: 52px; height: 30px; }
}
