:root {
  --brasil-verde: #009c3b;
  --brasil-amarelo: #ffdf00;
  --brasil-azul: #002776;
  --vermelho-1: #5a0000;
  --vermelho-2: #b3001b;
  --vermelho-3: #ff3b3b;
  --bg-deep: #050714;
  --bg-mid: #0a0e27;
  --text: #f3f4ff;
  --muted: #9aa1c7;
}

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

html, body { min-height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(ellipse at top left, rgba(0, 156, 59, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse at top right, rgba(255, 59, 59, 0.18) 0%, transparent 55%),
    linear-gradient(180deg, #101535 0%, var(--bg-mid) 40%, var(--bg-deep) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Header ---------- */
.hero {
  text-align: center;
  padding: 48px 16px 24px;
}

.hero h1 {
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--brasil-amarelo) 0%, var(--brasil-verde) 45%, #ffffff 50%, var(--vermelho-3) 55%, var(--vermelho-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.08);
}

.hero .cent { color: var(--brasil-amarelo); -webkit-text-fill-color: var(--brasil-amarelo); }

.hero .tagline {
  color: var(--muted);
  margin-top: 10px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* ---------- Arena ---------- */
.arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 20px;
  margin-top: 24px;
}

.side {
  position: relative;
  border-radius: 28px;
  padding: 36px 24px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.side::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  filter: blur(0);
  z-index: -1;
}

.side:hover { transform: translateY(-4px); }

.side-brasil {
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.2) 0%, transparent 60%),
    linear-gradient(135deg, var(--brasil-verde) 0%, #00b347 30%, var(--brasil-amarelo) 65%, var(--brasil-azul) 100%);
  box-shadow: 0 20px 50px rgba(0, 156, 59, 0.25), inset 0 0 60px rgba(0, 39, 118, 0.25);
}

.side-vermelho {
  background:
    radial-gradient(ellipse at top, rgba(255, 255, 255, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, var(--vermelho-1) 0%, var(--vermelho-2) 50%, var(--vermelho-3) 100%);
  box-shadow: 0 20px 50px rgba(196, 30, 58, 0.3), inset 0 0 60px rgba(90, 0, 0, 0.35);
}

.photo-wrap {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.25);
}

.photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.percent {
  font-size: clamp(48px, 7vw, 76px);
  font-weight: 900;
  margin-top: 20px;
  letter-spacing: -2px;
  line-height: 1;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
}

.name {
  margin-top: 10px;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.votes {
  font-size: 14px;
  opacity: 0.92;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.vote-btn {
  margin-top: 22px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.55);
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.vote-btn:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 3px;
}

/* ---------- Chart ---------- */
.chart-section,
.recent-section {
  margin-top: 56px;
}

.chart-section h2,
.recent-section h2 {
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  height: 320px;
  background: transparent;
}

#chart {
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

/* ---------- Recent list ---------- */
.recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.035);
  border-left: 4px solid;
  border-radius: 10px;
  font-size: 14px;
  transition: background 0.2s;
}

.recent-list li:hover { background: rgba(255, 255, 255, 0.06); }

.recent-list li.c1 { border-left-color: var(--brasil-verde); }
.recent-list li.c2 { border-left-color: var(--vermelho-3); }
.recent-list li.empty {
  border-left-color: transparent;
  color: var(--muted);
  justify-content: center;
  display: block;
  text-align: center;
}

.recent-list .email {
  color: #d6d9f0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-list .amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 92px;
}
.recent-list .badge {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.3px;
  min-width: 160px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-list li.c1 .badge { background: var(--brasil-verde); }
.recent-list li.c2 .badge { background: var(--vermelho-3); }

.recent-list li.flash {
  animation: flashIn 1.4s ease-out;
}

@keyframes flashIn {
  0%   { background: rgba(255, 255, 255, 0.25); transform: translateX(-8px); }
  100% { background: rgba(255, 255, 255, 0.035); transform: translateX(0); }
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 32px 16px 48px;
  color: var(--muted);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal.hidden { display: none; }

.modal-content {
  background: linear-gradient(180deg, #1a2050 0%, #131838 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 36px 32px 32px;
  max-width: 440px;
  width: 100%;
  position: relative;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 18px;
  background: none;
  border: none;
  color: #aab;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s;
}
.modal-close:hover { color: white; }

.modal-content h3 {
  margin-bottom: 22px;
  font-size: 20px;
  font-weight: 700;
}

.modal-content label {
  display: block;
  text-align: left;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 13px 14px;
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: white;
  font-size: 15px;
  font-family: inherit;
  transition: border 0.15s;
}

.modal-content input:focus,
.modal-content textarea:focus {
  outline: none;
  border-color: var(--brasil-amarelo);
}

.primary-btn {
  background: linear-gradient(135deg, var(--brasil-verde) 0%, var(--brasil-azul) 100%);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  width: 100%;
  letter-spacing: 0.4px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 156, 59, 0.35);
}

#qr-img {
  width: 260px;
  height: 260px;
  margin: 12px auto;
  display: block;
  border-radius: 14px;
  background: white;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#copia-cola {
  font-size: 11px;
  height: 90px;
  resize: none;
  word-break: break-all;
  font-family: 'Consolas', 'Courier New', monospace;
}

.muted { color: var(--muted); font-size: 13px; margin-top: 12px; }
.hint { color: #888; font-size: 12px; margin-top: 8px; }
.hidden { display: none !important; }

.status {
  margin-top: 18px;
  color: var(--brasil-amarelo);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 223, 0, 0.3);
  border-top-color: var(--brasil-amarelo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.check {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brasil-verde), #00b347);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(0, 156, 59, 0.5);
}

/* ---------- Responsivo ---------- */
@media (max-width: 760px) {
  .arena {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .vs { display: none; }
  .side { padding: 20px 12px 18px; border-radius: 20px; }
  .photo-wrap { width: 110px; height: 110px; border-width: 3px; }
  .percent { font-size: 38px; margin-top: 14px; letter-spacing: -1px; }
  .name { font-size: 15px; margin-top: 8px; }
  .votes { font-size: 12px; }
  .vote-btn { margin-top: 14px; padding: 10px 16px; font-size: 13px; }
  .hero { padding: 32px 16px 12px; }
  .chart-wrap { height: 260px; }
}
