:root {
  --gold: #ff5b00;
  --gold-dark: #cc4900;
  --silver: #c7ccd1;
  --silver-dark: #8f979e;
  --bronze: #d2996a;
  --bronze-dark: #a8683c;

  --bg: #f6f5f1;
  --text-dark: #23281f;
  --muted: #6c7167;

  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  position: relative;
  overflow-x: hidden;
}

/* Guirlanda de bandeirinhas de festa junina, com varal ondulado, no topo e no rodapé */
.guirlanda {
  position: relative;
  width: 100%;
  height: 90px;
  overflow: visible;
}

.corda-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bandeira {
  position: absolute;
  width: 28px;
  height: 32px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  box-shadow: 0 2px 4px rgba(35, 40, 31, 0.18);
}

.bandeira.padrao-solido {
  background: var(--cor);
}

.bandeira.padrao-pontos {
  background-color: var(--cor);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.9) 18%, transparent 19%);
  background-size: 9px 9px;
}

.bandeira.padrao-listras {
  background: repeating-linear-gradient(
    45deg,
    var(--cor) 0,
    var(--cor) 5px,
    rgba(255, 255, 255, 0.9) 5px,
    rgba(255, 255, 255, 0.9) 10px
  );
}

.page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  position: relative;
}

.title {
  text-align: center;
  font-size: clamp(3rem, 7vw, 5rem);
  margin: 0;
  font-weight: 800;
  letter-spacing: 1px;
  color: #303030;
}

.title-highlight {
  background: linear-gradient(135deg, #ff6b00 0%, #ffa733 50%, #ffe066 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.title-icon {
  display: block;
  width: 90px;
  height: 90px;
  object-fit: contain;
  flex-shrink: 0;
}

.subtitle {
  text-align: center;
  margin: 0.75rem 0 4rem;
  color: var(--muted);
  font-size: 1.15rem;
}

/* ---------- Pódio ---------- */

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 260px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--text-dark);
  border-radius: 24px;
  padding: 2rem 1.25rem 2.25rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 15px 35px rgba(35, 40, 31, 0.12);
  position: relative;
  margin-bottom: -1.5rem;
  z-index: 2;
}

.medal {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.team-name {
  font-weight: 700;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.team-score {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
}

.team-score span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pedestal {
  width: 100%;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1.5rem;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-dark);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.place-1 .pedestal { height: 240px; background: linear-gradient(180deg, rgba(255, 107, 0, 0.75) 20%, rgba(255, 167, 51, 0.68) 70%, rgba(255, 224, 102, 0.6)); }
.place-2 .pedestal { height: 180px; background: linear-gradient(180deg, rgba(199, 204, 209, 0.75), rgba(143, 151, 158, 0.6)); }
.place-3 .pedestal { height: 140px; background: linear-gradient(180deg, rgba(210, 153, 106, 0.75), rgba(168, 104, 60, 0.6)); }

.place-1 { order: 2; }
.place-2 { order: 1; }
.place-3 { order: 3; }

.place-1 .card {
  border: 2px solid transparent;
  background-image: linear-gradient(#fff, #fff),
    linear-gradient(135deg, #ff6b00, #ffa733, #ffe066);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transform: scale(1.05);
}
.place-2 .card { border: 2px solid var(--silver-dark); }
.place-3 .card { border: 2px solid var(--bronze-dark); }

/* ---------- Lista complementar ---------- */

.ranking {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 20px;
  padding: 1.75rem 2rem 2rem;
  box-shadow: 0 15px 35px rgba(35, 40, 31, 0.08);
}

.ranking-title {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
}

.ranking-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranking-list li {
  border-bottom: 1px solid rgba(35, 40, 31, 0.1);
}

.ranking-list li:last-child {
  border-bottom: none;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0.5rem;
  cursor: pointer;
}

.rank-row:hover .rank-name,
.rank-row:focus-visible .rank-name {
  color: var(--gold-dark);
}

.rank-row:focus-visible {
  outline: none;
  background: rgba(35, 40, 31, 0.05);
  border-radius: 10px;
}

.rank-position {
  flex: 0 0 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.rank-name {
  flex: 1;
  font-weight: 600;
  transition: color 0.15s ease;
}

.rank-score {
  font-weight: 700;
  color: var(--gold-dark);
}

.rank-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.rank-row.expandido .rank-chevron {
  transform: rotate(180deg);
}

.rank-detalhes {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.rank-detalhes.aberto {
  grid-template-rows: 1fr;
}

.rank-detalhes-inner {
  overflow: hidden;
  min-height: 0;
}

.rank-detalhes-titulo {
  margin: 0 0.5rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.rank-membros {
  list-style: none;
  margin: 0 0.5rem 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rank-membros li {
  border: none;
  background: rgba(35, 40, 31, 0.06);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.rank-membros-vazio {
  margin: 0 0.5rem 1rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

.rank-score span {
  font-weight: 500;
  opacity: 0.75;
  font-size: 0.8rem;
  margin-left: 0.25rem;
  color: var(--muted);
}

.ranking-empty {
  text-align: center;
  opacity: 0.7;
  padding: 1rem;
}

/* ---------- Gráfico do total geral ---------- */

.chart-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 20px;
  padding: 2rem 2rem 2.25rem;
  box-shadow: 0 15px 35px rgba(35, 40, 31, 0.08);
  margin-top: 2rem;
}

.chart-title {
  margin: 0 0 1.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.donut-container {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.donut {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 6px 14px rgba(35, 40, 31, 0.15));
}

.donut circle {
  transition: stroke-dasharray 1s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-total {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-dark);
  transition: transform 0.15s ease;
}

.donut-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 220px;
}

.chart-legend li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.95rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.legend-name {
  flex: 1;
  font-weight: 600;
}

.legend-percent {
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 560px) {
  .chart-wrapper {
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .podium-item { width: 45%; }
  .place-1, .place-2, .place-3 { order: initial; }
  .place-1 .card { transform: none; }
}

/* ---------- Confetes de boas-vindas ---------- */

.confete-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 50;
}

.confete-item {
  position: absolute;
  top: -20px;
  opacity: 0.95;
  animation-name: cair-confete;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

.confete-quadrado {
  border-radius: 2px;
}

.confete-circulo {
  border-radius: 50%;
}

@keyframes cair-confete {
  to {
    transform: translate(var(--deriva), 105vh) rotate(var(--giro));
    opacity: 0.85;
  }
}

