:root {
  --bg: #0b0f17;
  --panel: #121824;
  --panel-alt: #171f2e;
  --card: #1b2436;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f6fa;
  --subtext: #9ba8be;
  --red: #e11d48;
  --blue: #2563eb;
  --emerald: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.navbar {
  height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  gap: 24px;
  z-index: 30;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.header-scoreboard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.mini-score {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.mini-num {
  font-weight: 800;
  font-size: 0.76rem;
  padding: 3px 8px;
  border-radius: 6px;
  color: #fff;
}

.mini-num.num-13 { background: var(--red); }
.mini-num.num-22 { background: var(--blue); }

.mini-name {
  font-weight: 700;
  color: var(--text);
}

.mini-pct {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.c13-color { color: #fb7185; }
.c22-color { color: #60a5fa; }

.nav-progress {
  flex: 0 1 310px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--subtext);
  font-weight: 600;
}

.urnas-pct-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.75);
  animation: gentleBreath 2.8s ease-in-out infinite;
}

@keyframes gentleBreath {
  0%, 100% {
    opacity: 0.22;
    transform: scale(0.88);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.2);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.9);
  }
}

.nav-progress-labels strong {
  color: #34d399;
  font-size: 0.98rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.nav-progress-bar {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.nav-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: #090d14;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.nav-tab {
  background: transparent;
  color: var(--subtext);
  border: none;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 0.83rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}

.view {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
}

.view.active {
  display: flex;
}

#view-brasil {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 54% 50%, rgba(37, 99, 235, 0.09) 0%, transparent 52%),
    radial-gradient(circle at 54% 52%, #152033 0%, #0b0f17 74%);
}

.map-canvas {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 140px;
  position: relative;
  overflow: hidden;
}

.map-canvas.can-pan {
  cursor: grab;
}

.map-canvas.is-panning {
  cursor: grabbing;
}

#brazilMapSvg {
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 84px);
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.coast-halo {
  fill: none;
  stroke: rgba(148, 163, 184, 0.22);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.state-path {
  stroke: rgba(11, 15, 23, 0.94);
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: stroke 0.15s ease;
}

.map-canvas.is-panning .state-path {
  cursor: grabbing;
}

.state-path:hover {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.9;
}

.state-path.selected {
  stroke: #fbbf24;
  stroke-width: 2.5;
}

.state-label-bg {
  fill: rgba(11, 15, 23, 0.72);
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  rx: 3.5px;
  ry: 3.5px;
  pointer-events: none;
}

.state-label {
  fill: #f8fafc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.floating-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(18, 24, 36, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 215px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.55);
  z-index: 40;
  font-size: 0.8rem;
}

.tt-head {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.tt-urnas {
  color: var(--emerald);
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  font-weight: 600;
}

.inspector-card {
  position: absolute;
  left: 28px;
  top: 24px;
  width: 356px;
  background: rgba(18, 24, 36, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.inspector-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.badge-uf {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 3px 9px;
  border-radius: 6px;
  margin-bottom: 4px;
}

.inspector-top h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-ghost:hover {
  background: #263349;
}

.inspector-urnas {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(11, 15, 23, 0.85) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 14px;
  padding: 15px 16px;
  margin-bottom: 14px;
}

.inspector-urnas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}

.inspector-urnas-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #cbd5e1;
}

.inspector-urnas-pct {
  color: #34d399;
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.bar-track-sm {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 99px;
  overflow: hidden;
}

.bar-track-lg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill-green {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669, #34d399);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.inspector-urnas-sub {
  font-size: 0.86rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 9px;
  font-variant-numeric: tabular-nums;
}

.inspector-candidates {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cand-row-card {
  background: rgba(11, 15, 23, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 15px 16px;
}

.cand-row-card.card-13 {
  border-left: 4px solid var(--red);
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.12) 0%, rgba(11, 15, 23, 0.88) 70%);
}

.cand-row-card.card-22 {
  border-left: 4px solid var(--blue);
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.12) 0%, rgba(11, 15, 23, 0.88) 70%);
}

.cand-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}

.cand-row-id {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cand-row-name {
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
}

.cand-row-pct {
  font-weight: 800;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.cand-row-votes {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 9px;
  font-variant-numeric: tabular-nums;
}

.cand-row-votes span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--subtext);
}

.legend-pill {
  position: absolute;
  right: 28px;
  bottom: 24px;
  display: flex;
  gap: 18px;
  background: rgba(18, 24, 36, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-strong);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  z-index: 20;
}

.legend-pill span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-13 { background: var(--red); }
.dot-22 { background: var(--blue); }

#view-estados, #view-exterior {
  align-items: center;
  justify-content: center;
  padding: 22px 28px;
}

.state-focus-shell {
  width: 100%;
  max-width: 1180px;
  height: 100%;
  max-height: 690px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.state-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 18px;
  flex-shrink: 0;
}

.picker-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.arrow-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
}

.state-select {
  background: #090d14;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-width: 245px;
}

.state-select:focus {
  outline: none;
  border-color: var(--blue);
}

.uf-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.uf-chip {
  background: var(--panel-alt);
  color: var(--subtext);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.uf-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.uf-chip.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.state-focus-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 18px;
}

.state-silhouette-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.silhouette-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.region-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #38bdf8;
  margin-bottom: 4px;
}

.ext-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.silhouette-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.silhouette-uf {
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: 10px;
}

.silhouette-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#singleStateSvg, .globe-svg {
  width: 100%;
  height: 100%;
  max-height: 250px;
  shape-rendering: geometricPrecision;
}

.silhouette-footer {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(11, 15, 23, 0.8) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 14px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.silhouette-urnas-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 700;
}

.silhouette-urnas-row strong {
  color: #34d399;
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.silhouette-urnas-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.state-results-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.duel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.candidate-hero-card {
  background: var(--panel-alt);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.candidate-hero-card.hero-13 {
  border-top: 4px solid var(--red);
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.12) 0%, var(--panel-alt) 68%);
}

.candidate-hero-card.hero-22 {
  border-top: 4px solid var(--blue);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12) 0%, var(--panel-alt) 68%);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hero-party-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--subtext);
}

.hero-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.hero-bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.hero-pct {
  font-size: 2.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hero-votes {
  font-size: 0.96rem;
  font-weight: 700;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.split-bar-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.split-bar {
  height: 16px;
  background: #0d131f;
  border-radius: 99px;
  overflow: hidden;
  display: flex;
  gap: 3px;
}

.split-13 {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #be123c, #e11d48);
  transition: width 0.45s ease;
}

.split-22 {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  transition: width 0.45s ease;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-tile {
  background: rgba(11, 15, 23, 0.65);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.stat-tile span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--subtext);
  margin-bottom: 4px;
}

.stat-tile strong {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1080px) {
  .header-scoreboard { display: none; }
  .uf-strip { display: none; }
  .map-canvas { padding-left: 0; }
  .state-focus-grid {
    grid-template-columns: 1fr;
  }
  .state-silhouette-card {
    display: none;
  }
}
