:root {
  --pt-vermelho: #e30613;
  --pt-vermelho-escuro: #b8050f;
  --pt-vermelho-claro: #ff4d58;
  --pt-branco: #ffffff;
  --pt-texto: #1f2937;
  --pt-texto-muted: #6b7280;
  --pt-fundo: #f4f5f7;
  --pt-fundo-card: #ffffff;
  --pt-borda: #e5e7eb;
  --copa-accent-ouro: #c9a227;
  --copa-verde-campo: #009c3b;

  --copa-dourado: var(--pt-vermelho);
  --copa-dourado-hover: var(--pt-vermelho-claro);
  --copa-verde: var(--copa-verde-campo);
  --copa-card: var(--pt-fundo-card);
  --copa-radius: 12px;
  --transition: 0.2s ease;
  --navbar-height: 58px;

  --bs-body-bg: var(--pt-fundo);
  --bs-body-color: var(--pt-texto);
  --bs-primary: var(--pt-vermelho);
  --bs-primary-rgb: 227, 6, 19;
  --bs-link-color: var(--pt-vermelho);
  --bs-link-hover-color: var(--pt-vermelho-escuro);
  --bs-border-color: var(--pt-borda);
}

* { box-sizing: border-box; }

html,
body.app-body,
body.auth-page {
  background-color: var(--pt-fundo) !important;
  background-image: none !important;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--pt-texto) !important;
}

.auth-page {
  position: relative;
  overflow-x: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(227, 6, 19, 0.06) 0%, transparent 55%),
    var(--pt-fundo);
  pointer-events: none;
}

/* —— Logos / marca (circular) —— */
.auth-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 0 1.25rem;
}

/* Login: logomarca maior (cadastro mantém tamanho padrão abaixo) */
.auth-page--login .auth-logo-wrap {
  margin-bottom: 1.5rem;
}

.auth-page--login .auth-logo {
  width: 220px;
  height: 220px;
}

.auth-page--login .auth-logo img,
.auth-page--login .auth-logo-img {
  width: 200px !important;
  height: 200px !important;
  max-width: 200px !important;
  max-height: 200px !important;
  border-width: 5px !important;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.15),
    0 10px 36px rgba(227, 6, 19, 0.5);
}

.brand-logo {
  flex-shrink: 0;
}

.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 152px;
  height: 152px;
  margin: 0 auto;
  padding: 0;
}

.auth-logo img,
.auth-logo-img {
  display: block;
  width: 140px !important;
  height: 140px !important;
  max-width: 140px !important;
  max-height: 140px !important;
  margin: 0 auto;
  padding: 0;
  border-radius: 50% !important;
  object-fit: cover;
  object-position: center center;
  border: 4px solid var(--pt-vermelho) !important;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.12),
    0 8px 28px rgba(227, 6, 19, 0.45);
  background: #fff;
}

.navbar-brand-wrap {
  flex-shrink: 0;
}

.navbar-brand-link {
  color: inherit;
  text-decoration: none;
}

.navbar-brand-link:hover {
  color: var(--pt-branco);
  opacity: 0.95;
}

.logo-lightbox-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  line-height: 0;
  border-radius: 50%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-lightbox-trigger:hover {
  transform: scale(1.06);
}

.logo-lightbox-trigger:focus-visible {
  outline: 2px solid var(--copa-accent-ouro);
  outline-offset: 3px;
}

.logo-lightbox-trigger--auth .auth-logo {
  pointer-events: none;
}

.navbar-brand-logo {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px;
  min-height: 42px;
  object-fit: cover;
  object-position: center center;
  border-radius: 50% !important;
  border: 2px solid var(--pt-vermelho) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  background: #fff;
  pointer-events: none;
}

/* Lightbox logomarca */
.logo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.logo-lightbox[hidden] {
  display: none !important;
}

.logo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
}

.logo-lightbox-panel {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 520px);
  width: 100%;
  padding: 1.5rem 1.35rem 1.25rem;
  background: var(--pt-fundo-card);
  border-radius: var(--copa-radius);
  border: 1px solid var(--pt-borda);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: logoLightboxIn 0.25s ease;
}

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

.logo-lightbox-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 1rem;
  color: var(--pt-texto);
}

.logo-lightbox-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.75rem;
}

.logo-lightbox-frame img {
  width: min(80vw, 400px);
  height: min(80vw, 400px);
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 5px solid var(--pt-vermelho);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.9),
    0 12px 40px rgba(227, 6, 19, 0.35);
  background: #fff;
}

.logo-lightbox-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--pt-texto);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.15s ease;
}

.logo-lightbox-close:hover {
  background: var(--pt-vermelho);
  color: #fff;
}

body.logo-lightbox-open {
  overflow: hidden;
}

.app-navbar .navbar-brand,
.app-navbar .navbar-brand-wrap {
  flex-shrink: 0;
  margin-right: 2rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  gap: 0.65rem !important;
}

.app-navbar .navbar-collapse {
  flex-grow: 1;
}

.app-navbar .navbar-nav {
  gap: 0.35rem;
}

.app-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
  color: rgba(255, 255, 255, 0.92);
}

.text-gold {
  color: var(--copa-dourado) !important;
}

a.text-gold:hover {
  color: var(--copa-dourado-hover) !important;
}

.app-navbar {
  background: var(--pt-vermelho) !important;
  border-bottom: none;
  box-shadow: 0 2px 12px rgba(227, 6, 19, 0.2);
  min-height: var(--navbar-height);
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.app-navbar .navbar-brand span,
.app-navbar .navbar-brand-text {
  color: var(--pt-branco);
  font-size: 0.9rem;
  line-height: 1.25;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52vw;
}

@media (min-width: 992px) {
  .app-navbar .navbar-brand-text {
    max-width: none;
    font-size: 1rem;
  }
}

.app-navbar .nav-link:hover {
  color: #fff;
}

.app-navbar .nav-link.active {
  color: #fff !important;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.app-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.5);
}

.app-navbar .navbar-toggler-icon {
  filter: brightness(10);
}

.btn.btn-gold,
button.btn-gold {
  background: linear-gradient(135deg, #e30613, #b8050f) !important;
  background-color: #e30613 !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 700;
  transition: var(--transition);
}

.btn.btn-gold:hover,
.btn.btn-gold:focus,
.btn.btn-gold:active,
button.btn-gold:hover {
  background: linear-gradient(135deg, #ff3d4a, #e30613) !important;
  background-color: #ff3d4a !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(227, 6, 19, 0.55) !important;
}

.btn-outline-gold {
  border-color: var(--pt-vermelho);
  color: var(--pt-vermelho);
}

.btn-outline-gold:hover,
.btn-outline-gold.active {
  background: var(--pt-vermelho);
  color: var(--pt-branco);
  border-color: var(--pt-vermelho);
}

.auth-card,
.app-section,
.stat-card,
.jogo-card {
  background: var(--pt-fundo-card);
  border-radius: var(--copa-radius);
  border: 1px solid var(--pt-borda);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: var(--transition);
}

.app-section {
  padding: 1.25rem 1.35rem;
}

.jogos-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-card .form-control,
.app-section .form-control,
.jogo-card .form-control {
  background: #fff;
  border-color: var(--pt-borda);
  color: var(--pt-texto);
}

.auth-card .form-control:focus,
.app-section .form-control:focus {
  border-color: var(--pt-vermelho) !important;
  box-shadow: 0 0 0 0.2rem rgba(227, 6, 19, 0.15) !important;
}

.stat-card {
  padding: 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pt-vermelho), var(--copa-accent-ouro), var(--copa-verde-campo));
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--pt-vermelho);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding: 0.15rem 0 0.65rem;
  border-bottom: 2px solid rgba(227, 6, 19, 0.15);
  color: var(--pt-texto);
}

.section-title i {
  color: var(--pt-vermelho);
}

.jogo-card {
  padding: 1.25rem 1.35rem;
  margin-bottom: 0;
  animation: fadeIn 0.3s ease;
}

.jogo-card:hover {
  border-color: rgba(227, 6, 19, 0.45);
  transform: translateX(4px);
}

.jogo-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  padding: 0.35rem 0 0.15rem;
}

.team-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.team-block strong {
  line-height: 1.35;
  padding: 0.15rem 0;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.team-block.away {
  flex-direction: row-reverse;
  justify-content: flex-start;
  justify-self: end;
}

.team-flag-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 28px;
  flex-shrink: 0;
}

.team-flag-wrap img {
  display: block;
  width: 36px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 1;
}

.team-flag-fallback {
  display: none;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--pt-vermelho);
  background: #f3f4f6;
  border: 1px solid var(--pt-borda);
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  line-height: 1;
}

.team-flag-fallback.show {
  display: inline-flex;
}

.palpite-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
  justify-self: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.palpite-inputs input {
  width: 48px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  background: #fff;
  border: 1px solid var(--pt-borda);
  color: var(--pt-texto);
  border-radius: 8px;
  padding: 0.35rem;
}

.jogo-bloqueio-msg {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pt-vermelho-escuro);
  background: #fef2f2;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  margin-top: 0.35rem;
}

.palpite-inputs input:focus {
  border-color: var(--pt-vermelho);
  outline: none;
  box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.3);
}

.palpite-inputs input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.palpite-x {
  font-weight: 800;
  color: var(--pt-vermelho);
}

.jogo-meta {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--pt-borda);
}

.badge-conquista {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fef2f2;
  color: var(--pt-vermelho);
  margin-right: 4px;
  font-size: 0.75rem;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.15rem;
  border-bottom: 1px solid var(--pt-borda);
  animation: slideUp 0.4s ease;
}

.rank-item:last-child {
  border-bottom: none;
  padding-bottom: 0.25rem;
}

#rankingTop .rank-item:first-child,
#warmupDashTop .rank-item:first-child {
  padding-top: 0.35rem;
}

.rank-pos {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-right: 0.75rem;
  flex-shrink: 0;
  background: #f3f4f6;
  color: var(--pt-texto);
}

.rank-pos.gold {
  background: linear-gradient(135deg, var(--copa-accent-ouro), #a88620);
  color: #1a0a0c;
}

.rank-pos.silver {
  background: linear-gradient(135deg, #e0e0e0, #a8a8a8);
  color: #1a0a0c;
}

.rank-pos.bronze {
  background: linear-gradient(135deg, #cd7f32, #8b4513);
  color: #fff;
}

.rank-up {
  animation: rankPulse 0.6s ease;
  color: var(--copa-verde-campo);
}

.app-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}

.app-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-ball {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--pt-vermelho));
  animation: bounce 0.6s ease infinite alternate;
  box-shadow: 0 0 30px rgba(227, 6, 19, 0.5);
}

.app-footer {
  border-top: 1px solid rgba(227, 6, 19, 0.2);
  margin-top: 3rem;
}

.my-rank-highlight {
  background: #fef2f2;
  border: 1px solid rgba(227, 6, 19, 0.2);
  border-radius: var(--copa-radius);
  padding: 1rem;
}

.pontos-ganhos {
  color: var(--copa-verde-campo);
  font-weight: 700;
  font-size: 0.85rem;
}

.status-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  text-transform: uppercase;
}

.status-scheduled {
  background: #ecfdf5;
  color: #047857;
}

.status-live {
  background: #fef2f2;
  color: var(--pt-vermelho);
  animation: pulse 1s infinite;
}

.status-finished {
  background: #f3f4f6;
  color: var(--pt-texto-muted);
}

.page-link {
  background: #fff;
  border-color: var(--pt-borda);
  color: var(--pt-texto);
}

.page-item.active .page-link {
  background: var(--pt-vermelho);
  border-color: var(--pt-vermelho);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes bounce {
  to { transform: translateY(-20px); }
}

@keyframes pulse {
  50% { opacity: 0.65; }
}

@keyframes rankPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@media (max-width: 576px) {
  .stat-value {
    font-size: 1.5rem;
  }

  .jogo-teams {
    column-gap: 0.35rem;
  }

  .team-block {
    gap: 0.35rem;
  }

  .team-block strong {
    font-size: 0.8rem;
  }

  .team-flag-wrap {
    width: 32px;
    height: 22px;
  }

  .team-flag-wrap img {
    width: 30px;
    height: 20px;
  }

  .palpite-inputs input {
    width: 36px;
    font-size: 1rem;
    padding: 0.25rem;
  }

  .palpite-x {
    font-size: 0.85rem;
  }

  .auth-page--login .auth-logo {
    width: 188px;
    height: 188px;
  }

  .auth-page--login .auth-logo img,
  .auth-page--login .auth-logo-img {
    width: 172px !important;
    height: 172px !important;
    max-width: 172px !important;
    max-height: 172px !important;
  }

  .auth-logo {
    width: 132px;
    height: 132px;
  }

  .auth-logo img,
  .auth-logo-img {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
  }

  .navbar-brand-logo {
    width: 36px;
    height: 36px;
  }

  .app-navbar .navbar-brand span {
    font-size: 0.9rem;
  }

  .warmup-rank-card {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .warmup-rank-pts {
    width: 100%;
    text-align: right;
  }
}

/* —— Ranking: Aquecimento / gamificação —— */
.ranking-tabs {
  border-bottom: 2px solid var(--pt-borda);
}

.ranking-tabs .nav-link {
  color: var(--pt-texto-muted);
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-weight: 600;
}

.ranking-tabs .nav-link:hover {
  color: var(--pt-vermelho);
  border-color: rgba(227, 6, 19, 0.25);
}

.ranking-tabs .nav-link.active {
  color: var(--pt-vermelho) !important;
  background: transparent !important;
  border-bottom-color: var(--pt-vermelho) !important;
}

.warmup-intro {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--pt-vermelho);
}

.warmup-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.warmup-rank-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid var(--pt-borda);
  transition: var(--transition);
}

.warmup-rank-card:hover {
  border-color: rgba(227, 6, 19, 0.3);
}

.warmup-rank-card-me {
  border-color: var(--pt-vermelho) !important;
  background: #fef2f2;
}

.warmup-rank-body {
  flex: 1;
  min-width: 0;
}

.warmup-rank-name {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.warmup-rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 0.35rem;
}

.warmup-rank-pts {
  font-size: 1.15rem;
  white-space: nowrap;
}

.warmup-rank-pts small {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.8;
}

.warmup-progress-bar-wrap {
  height: 6px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
}

.warmup-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--pt-vermelho-escuro), var(--pt-vermelho-claro));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.warmup-badge-complete {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4ade80;
  background: rgba(0, 156, 59, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.warmup-missions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.warmup-mission-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--pt-borda);
  background: #fafafa;
}

.warmup-mission-card.mission-done {
  border-color: rgba(227, 6, 19, 0.25);
  background: #fef2f2;
}

.warmup-mission-card.mission-done .mission-icon {
  color: var(--pt-vermelho);
}

.warmup-mission-card.mission-pending .mission-icon {
  color: #d1d5db;
}

.mission-text {
  flex: 1;
  min-width: 0;
}

.mission-pts {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pt-vermelho);
  white-space: nowrap;
}

.warmup-my-stats .display-6 {
  font-size: 2rem;
}

.warmup-dash-card {
  border-left: 4px solid var(--pt-vermelho);
}

.table-active.warmup-row-me {
  --bs-table-bg-state: rgba(227, 6, 19, 0.15);
}

/* —— Ranking: palpites por jogador —— */
.rank-expand-col {
  width: 2rem;
}

.rank-expand-btn {
  color: var(--pt-vermelho);
  text-decoration: none;
}

.rank-main-row {
  cursor: pointer;
}

.rank-main-row.is-expanded {
  background: rgba(227, 6, 19, 0.04);
}

.rank-palpites-detail {
  background: #f9fafb;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.rank-palpites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.rank-palpite-item {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}

.rank-palpite-placar {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pt-vermelho);
  margin: 0.25rem 0;
}

.rank-card-expandable {
  cursor: pointer;
  flex-wrap: wrap;
  align-items: flex-start;
}

.rank-card-expandable.is-expanded {
  border-color: rgba(227, 6, 19, 0.35);
}

.rank-palpites-mobile {
  margin-top: 0.75rem;
  width: 100%;
}
