/* ══════════ ABA RANKING & PÓDIO ══════════ */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Pódio dos 3 Primeiros */
.podium-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  margin: 20px 0 32px;
  padding: 0 8px;
}

.podium-spot {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.podium-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 6px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.podium-spot.first .podium-avatar {
  width: 68px;
  height: 68px;
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  background: #fffbeb;
}

.podium-crown {
  position: absolute;
  top: -16px;
  font-size: 1.25rem;
}

.podium-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-1);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.podium-pts {
  font-family: 'Outfit', sans-serif;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-gold-dark);
  margin-bottom: 6px;
}

.podium-pillar {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.podium-spot.first .podium-pillar {
  height: 110px;
  background: linear-gradient(180deg, #fde68a, #fef3c7);
  border: 1.5px solid #f59e0b;
  color: #92400e;
}
.podium-spot.second .podium-pillar {
  height: 80px;
  background: linear-gradient(180deg, #e2e8f0, #f1f5f9);
  border: 1.5px solid #94a3b8;
  color: #475569;
}
.podium-spot.third .podium-pillar {
  height: 60px;
  background: linear-gradient(180deg, #fed7aa, #ffedd5);
  border: 1.5px solid #ea580c;
  color: #9a3412;
}

/* Lista de Ranking */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leader-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}
.leader-row:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.leader-rank {
  width: 32px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-3);
  text-align: center;
}

.leader-rank.top-1 { color: #d97706; }
.leader-rank.top-2 { color: #64748b; }
.leader-rank.top-3 { color: #c2410c; }

.leader-info {
  flex: 1;
}
.leader-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-1);
}
.leader-sub {
  font-size: 0.78rem;
  color: var(--text-2);
}

.leader-score {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary);
}

/* Barra de Título do Ranking */
.ranking-toolbar {
  margin: 24px 0 16px;
}

/* Ações no Final do Ranking */
.ranking-footer-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.btn-export-csv {
  background: #ffffff;
  border: 1.5px solid var(--border);
  color: var(--text-1);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.btn-export-csv:hover {
  background: var(--bg-warm-tint);
  border-color: #d6bead;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ══════════ MODAL DE SUCESSO ══════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 26, 16, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  padding: 28px 24px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalZoom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalZoom {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-confetti-badge {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--bg-warm-tint);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 16px;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.92rem;
  color: var(--text-2);
  margin-bottom: 20px;
}

.modal-score-box {
  background: var(--bg-warm-tint);
  border: 1px solid #e2d2c3;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 22px;
}

.modal-score-val {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.modal-score-caption {
  font-size: 0.8rem;
  color: var(--text-2);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.modal-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-wa-share {
  background: #25d366;
  color: #0b0f19;
  border: none;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
  transition: background 0.2s, transform 0.15s;
}
.btn-wa-share:hover { background: #22c55e; transform: translateY(-1px); }

.btn-modal-rank {
  background: #fbf7f2;
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-modal-rank:hover { background: #f0e6dc; }

.btn-close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Canvas de Confete */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

/* Toolbar Semântica do Ranking */
.ranking-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-1);
}

.history-toggle-wrap {
  margin-top: 14px;
  text-align: center;
}

.btn-toggle-history {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.btn-toggle-history:hover {
  background: var(--bg-warm-tint);
  border-color: #d6bead;
  transform: translateY(-1px);
}

/* Seção de Histórico Recente */
.history-section {
  margin-top: 32px;
}

.history-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-2);
  margin-bottom: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.history-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-md);
}

.history-card-name {
  color: var(--text-1);
  font-weight: 700;
}

.history-card-date {
  color: var(--text-3);
  font-size: 0.78rem;
  margin-left: 6px;
}

.history-card-score {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  color: var(--primary);
}

/* Estado Vazio Elegante */
.empty-ranking {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
}

.empty-ranking-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-ranking-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 6px;
}

.empty-ranking-desc {
  font-size: 0.9rem;
  color: var(--text-2);
  max-width: 360px;
  margin: 0 auto;
}

/* Rodapé Global & Badge */
.app-footer {
  margin-top: 36px;
  padding-bottom: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.cloud-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cloud-dot.online { background: #16a34a; box-shadow: 0 0 8px rgba(22, 163, 74, 0.7); }
.cloud-dot.local { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
