/* Chaves Copa 2026 — visual com circulos (estilo escalador) + modal de selecao */
:root {
  --verde-brasil: #009c3b;
  --verde-escuro: #0d6e2c;
  --verde-mais-escuro: #08501f;
  --amarelo-brasil: #ffdf00;
  --azul-brasil: #002776;
  --texto: #1a2b20;
  --texto-suave: #4a5b50;
  --circle-md: clamp(48px, 7vw, 64px);
  --circle-sm: clamp(36px, 5vw, 44px);
}

.chaves-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px 50px;
}

.chaves-intro {
  text-align: center;
  margin: 14px 0 20px;
  color: #ffffff;
}
.chaves-intro h1 {
  color: var(--amarelo-brasil);
  font-size: clamp(28px, 6vw, 44px);
  margin: 0 0 10px;
  font-weight: 900;
}
.chaves-intro .lead {
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(15px, 2.5vw, 18px);
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.55;
}
.tournament-status {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 18px;
  background: rgba(255, 223, 0, 0.16);
  border: 1px solid rgba(255, 223, 0, 0.5);
  border-radius: 999px;
  color: var(--amarelo-brasil);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.tournament-status strong { color: #ffffff; }

.chaves-step {
  background: #ffffff;
  border-radius: 16px;
  padding: 26px 22px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  border-top: 4px solid var(--amarelo-brasil);
}
.chaves-step[hidden] { display: none; }

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c853 0%, var(--verde-brasil) 100%);
  color: #ffffff;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 156, 59, 0.3);
}
.step-header h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 24px);
  color: var(--verde-mais-escuro);
  font-weight: 900;
  flex: 1;
  min-width: 200px;
}
.step-header p {
  width: 100%;
  font-size: 14px;
  color: var(--texto-suave);
  margin: 4px 0 0;
}

/* ========== CIRCULO DE TIME (estilo escalador) ========== */
.team-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--circle-md);
  height: var(--circle-md);
  border-radius: 50%;
  background: #f7faf8;
  border: 3px solid #d8e6dd;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.team-circle-md { width: var(--circle-md); height: var(--circle-md); }
.team-circle-sm { width: var(--circle-sm); height: var(--circle-sm); border-width: 2px; }
.team-circle-empty {
  background: #ffffff;
  border-style: dashed;
  border-color: #aebbb4;
  color: var(--texto-suave);
  font-weight: 900;
  font-size: 18px;
}
.team-circle-filled {
  background: linear-gradient(135deg, #e8f5ec 0%, #ffffff 100%);
  border-color: var(--verde-brasil);
}
.team-flag {
  font-size: calc(var(--circle-md) * 0.66);
  line-height: 1;
}
.team-circle-sm .team-flag {
  font-size: calc(var(--circle-sm) * 0.66);
}
/* Imagem real da bandeira preenchendo o circulo. */
.team-flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.team-plus {
  font-size: 28px;
  font-weight: 800;
  color: var(--verde-brasil);
}

/* ========== Grupos: podio com slots clicaveis ========== */
/* ========== Forecast CTA ========== */
.forecast-cta {
  margin: 6px 0 22px;
  display: flex;
  justify-content: center;
}
.btn-forecast {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffdf00 0%, #ffb700 100%);
  color: var(--verde-mais-escuro);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 8px 24px rgba(255, 200, 0, 0.35);
  transition: transform 140ms ease, box-shadow 140ms ease;
  max-width: 560px;
  width: 100%;
}
.btn-forecast:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 200, 0, 0.5);
}
.btn-forecast:active { transform: translateY(0); }
.forecast-sparkle {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.forecast-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.forecast-text strong {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--verde-mais-escuro);
}
.forecast-text small {
  font-size: 12px;
  font-weight: 600;
  color: rgba(8, 80, 31, 0.78);
  line-height: 1.4;
}

.grupos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.grupo-card {
  background: #f7faf8;
  border: 2px solid #d8e6dd;
  border-radius: 12px;
  padding: 14px 12px;
  transition: border-color 150ms ease, background 150ms ease;
}
.grupo-card.destaque {
  border-color: var(--amarelo-brasil);
  background: #fffbe5;
}
.grupo-card.complete {
  border-color: var(--verde-brasil);
  background: #effaf2;
}
.grupo-card.locked {
  border-color: #b8d4c2;
  background: #f0f6f3;
  opacity: 0.95;
}
.grupo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d8e6dd;
}
.grupo-letra {
  font-size: 14px;
  font-weight: 900;
  color: var(--verde-mais-escuro);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.grupo-lock {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #ffffff;
  background: var(--verde-brasil);
  padding: 4px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.grupo-date {
  font-size: 10px;
  font-weight: 700;
  color: var(--texto-suave);
}

.grupo-podio {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grupo-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: #ffffff;
  border: 1.5px solid #e2eae5;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 130ms ease, transform 100ms ease, background 130ms ease;
}
.grupo-slot:hover:not(:disabled) {
  border-color: var(--verde-brasil);
  background: #f7faf8;
}
.grupo-slot:active:not(:disabled) {
  transform: scale(0.98);
}
.grupo-slot:disabled {
  cursor: default;
}
.grupo-slot.filled {
  background: #ffffff;
}
.grupo-slot.locked {
  background: #f7faf8;
  border-color: #c8d6cd;
}
.slot-pos {
  font-size: 13px;
  font-weight: 900;
  color: var(--verde-mais-escuro);
  background: var(--amarelo-brasil);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.grupo-slot.pos-1 .slot-pos { background: linear-gradient(135deg, #ffd700, #ffb000); color: #5d3a00; }
.grupo-slot.pos-2 .slot-pos { background: linear-gradient(135deg, #c4c4c4, #8c8c8c); color: #ffffff; }
.grupo-slot.pos-3 .slot-pos { background: linear-gradient(135deg, #cd7f32, #8a5722); color: #ffffff; }
.grupo-slot.pos-4 .slot-pos { background: #b8c0bc; color: #ffffff; }

.slot-nome {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--texto);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grupo-slot.empty .slot-nome {
  color: var(--texto-suave);
  font-weight: 600;
  font-style: italic;
}
.slot-mark {
  font-size: 18px;
}

/* ========== Modal de selecao ========== */
body.modal-open { overflow: hidden; }
.chaves-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.chaves-modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 30, 16, 0.7);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border-top: 4px solid var(--amarelo-brasil);
  overflow: hidden;
  animation: modalIn 200ms cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2eae5;
}
.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  color: var(--verde-mais-escuro);
}
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1.5px solid #d8e6dd;
  background: #ffffff;
  font-size: 22px;
  cursor: pointer;
  color: var(--texto-suave);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.modal-close:hover { background: #f7faf8; color: var(--verde-mais-escuro); }
.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}
.team-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid #e2eae5;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 130ms ease, transform 100ms ease, background 130ms ease;
}
.team-picker-item:hover {
  border-color: var(--verde-brasil);
  background: #f7faf8;
}
.team-picker-item:active { transform: scale(0.98); }
.team-picker-item.taken { opacity: 0.6; }
.team-picker-item.taken .team-circle-filled { border-color: #b8c0bc; }
.team-picker-clear { border-style: dashed; }
.team-picker-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.team-picker-nome {
  font-size: 15px;
  font-weight: 700;
  color: var(--texto);
}
.team-picker-tag {
  font-size: 11px;
  color: var(--texto-suave);
  font-weight: 600;
}

/* ========== Thirds ========== */
.thirds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.third-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 2px solid #d8e6dd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: var(--texto);
  text-align: left;
  width: 100%;
  transition: all 130ms ease;
  font-family: inherit;
}
.third-chip:hover { border-color: var(--verde-brasil); transform: translateY(-1px); }
.third-chip.selected {
  background: #effaf2;
  border-color: var(--verde-brasil);
  color: var(--verde-mais-escuro);
}
.third-chip-nome { flex: 1; }
.third-chip-grupo {
  font-size: 10px;
  color: var(--texto-suave);
  font-weight: 800;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px 7px;
  border-radius: 4px;
}
.third-chip.selected .third-chip-grupo {
  background: rgba(0, 156, 59, 0.15);
  color: var(--verde-mais-escuro);
}
.thirds-counter {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--verde-mais-escuro);
  margin: 14px 0;
}
.thirds-counter strong { color: var(--verde-brasil); font-size: 18px; }

/* ========== Bracket ========== */
.bracket-rounds {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 14px 4px;
}
.bracket-column {
  flex: 0 0 250px;
  min-width: 250px;
  display: flex;
  flex-direction: column;
}
.bracket-column h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 900;
  color: var(--verde-mais-escuro);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  background: var(--amarelo-brasil);
  padding: 6px 10px;
  border-radius: 6px;
}
.bracket-matches {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.bracket-match {
  background: #ffffff;
  border: 2px solid #d8e6dd;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.bracket-match.has-winner { border-color: var(--verde-brasil); }
.bracket-match.locked {
  border-color: #aebbb4;
  background: #fafcfb;
}
.match-num {
  font-size: 10px;
  color: var(--texto-suave);
  font-weight: 800;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.04);
  letter-spacing: 0.05em;
  text-align: center;
}
.bracket-match.locked .match-num { background: rgba(0, 100, 50, 0.08); color: var(--verde-mais-escuro); }
.match-team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: #ffffff;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--texto);
  border-bottom: 1px solid #f0f4f1;
  transition: background 120ms ease;
  font-family: inherit;
}
.match-team:last-child { border-bottom: none; }
.match-team:hover:not(:disabled):not(.winner):not(.loser):not(.empty) {
  background: #effaf2;
}
.match-team.winner {
  background: linear-gradient(135deg, var(--verde-brasil) 0%, var(--verde-escuro) 100%);
  color: #ffffff;
  font-weight: 800;
}
.match-team.winner .team-circle-sm { border-color: #ffffff; background: rgba(255,255,255,0.15); }
.match-team.loser {
  opacity: 0.4;
  text-decoration: line-through;
}
.match-team.empty {
  font-style: italic;
  color: var(--texto-suave);
  cursor: default;
  background: #f7faf8;
}
.match-team:disabled { cursor: default; }
.match-team-nome {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-team-pos {
  font-size: 9px;
  color: var(--texto-suave);
  font-weight: 900;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  flex-shrink: 0;
}
.match-team.winner .match-team-pos {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* ========== Champion ========== */
.champion-card {
  text-align: center;
  padding: 36px 20px;
  background: linear-gradient(135deg, #ffdf00 0%, #ffb700 100%);
  border-radius: 16px;
  margin: 16px 0;
  box-shadow: 0 8px 30px rgba(255, 200, 0, 0.4);
}
.champion-card .flag { font-size: 80px; line-height: 1; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2)); }
.champion-card .nome {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 900;
  color: var(--verde-mais-escuro);
  margin: 10px 0 6px;
}
.champion-card .label {
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--verde-mais-escuro);
  opacity: 0.85;
}
.trophy-icon { font-size: 40px; }
.champion-empty {
  text-align: center;
  padding: 30px;
  color: var(--texto-suave);
  font-size: 15px;
}

/* ========== Botoes ========== */
.step-cta {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-primary, .btn-secondary {
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: filter 120ms ease, transform 120ms ease;
}
.btn-primary {
  background: linear-gradient(135deg, #00c853 0%, var(--verde-brasil) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 156, 59, 0.3);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn-secondary {
  background: #ffffff;
  color: var(--verde-mais-escuro);
  border: 2px solid var(--verde-brasil);
}
.btn-secondary:hover { background: #effaf2; }

.ad-slot {
  margin: 16px 0;
  text-align: center;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

/* ========== Mobile ========== */
@media (max-width: 700px) {
  .chaves-main { padding: 14px 10px 30px; }
  .chaves-step { padding: 20px 14px; }
  .grupos-grid { grid-template-columns: 1fr; }
  .thirds-grid { grid-template-columns: 1fr 1fr; }
  .step-cta { flex-direction: column; }
  .step-cta button { width: 100%; }
}
@media (max-width: 420px) {
  .thirds-grid { grid-template-columns: 1fr; }
}
