:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #131b2e;
  --bg-card: #1e293b;
  --bg-card-hover: #27354f;
  --border-color: #334155;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: calc(75px + var(--safe-bottom));
  overflow-x: hidden;
}

/* ── Container ─────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

.container-wide {
  max-width: 1100px;
}

/* ── Header e Navegação ─────────────────────────────────────────────────────── */
.header-bar {
  background: linear-gradient(180deg, rgba(19, 27, 46, 0.95) 0%, rgba(10, 15, 29, 0.95) 100%);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 16px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  font-size: 24px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Bottom Bar Fixa para Navegação Rápida no Mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 23, 42, 0.96);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 40;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  gap: 4px;
  width: 25%;
  height: 100%;
  transition: color 0.15s ease;
}

.bottom-nav a.active, .bottom-nav a:hover {
  color: var(--accent-gold);
}

.bottom-nav a span.icon {
  font-size: 18px;
}

/* ── Cards & Superfícies ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-highlight {
  background: linear-gradient(145deg, #1e293b 0%, #152033 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  position: relative;
  overflow: hidden;
}

.card-highlight::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Vagas & Barra de Progresso ────────────────────────────────────────────── */
.progress-group {
  margin: 12px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.fill-gold { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.fill-green { background: linear-gradient(90deg, #059669, #10b981); }
.fill-blue { background: linear-gradient(90deg, #2563eb, #3b82f6); }

.info-banner {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #93c5fd;
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.transparency-banner {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.88rem;
  color: #a7f3d0;
  margin: 14px 0;
  line-height: 1.45;
}

/* ── Formulários & Inputs Ergonômicos ───────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

/* Seletor de Posição (Linha vs Goleiro) */
.pos-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.pos-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background: #0f172a;
  cursor: pointer;
  padding: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

.pos-option.selected {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
}

.pos-option .pos-icon {
  font-size: 22px;
}

.pos-option .pos-text {
  font-size: 0.88rem;
  font-weight: 700;
  margin-top: 2px;
}

.pos-option .pos-badge {
  font-size: 0.68rem;
  color: var(--accent-gold);
  margin-top: 2px;
}

/* ── Botões Touch de 48px a 52px ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  gap: 8px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-green {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background: #334155;
  color: var(--text-main);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-sm {
  min-height: 38px;
  font-size: 0.85rem;
  padding: 0 12px;
}

/* ── Listas de Atletas & Cards Empilhados ──────────────────────────────────── */
.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 22px;
}

.player-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-gol { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-linha { background: rgba(59, 130, 246, 0.2); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-espera { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.4); }
.badge-ok { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

/* ── Modal de Pagamento Pix ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  text-align: center;
  position: relative;
}

.qr-box {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
  margin: 14px auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.qr-box img {
  display: block;
  width: 190px;
  height: 190px;
}

.pix-copia-box {
  background: #0f172a;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
  max-height: 55px;
  overflow-y: auto;
  margin: 10px 0;
}

.timer-box {
  font-size: 0.85rem;
  color: var(--accent-gold);
  font-weight: 700;
  margin-bottom: 12px;
}

/* ── Chaveamento & Jogos ao Vivo ───────────────────────────────────────────── */
.game-card {
  background: #131b2e;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.matchup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.team-badge-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.team-badge-box.vencedor {
  border-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.1);
}

.team-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-bottom: 6px;
}

.team-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
}

.score-numbers {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
}

.penalties-note {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-weight: 700;
}

/* Roster do time para marcação de gols */
.roster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.roster-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-goal-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
}

.player-goal-btn:hover {
  background: #1e293b;
  border-color: var(--accent-green);
}

/* ── Histórico & Ranking ───────────────────────────────────────────────────── */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.ranking-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  font-size: 0.88rem;
}

.rank-pos {
  font-weight: 800;
  color: var(--accent-gold);
}

/* ── Telão Mode (Full TV / Datashow) ───────────────────────────────────────── */
.telao-body {
  background: radial-gradient(circle at center, #1e293b 0%, #0a0f1d 100%);
  padding: 24px;
}

.telao-title {
  font-size: 2.4rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: -1px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.telao-sub {
  text-align: center;
  color: var(--accent-gold);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.telao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.telao-team-card {
  background: rgba(19, 27, 46, 0.9);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.3s;
}

.telao-team-card.revelado {
  border-color: var(--accent-gold);
  animation: pulseCard 1s ease;
}

@keyframes pulseCard {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}

@media (min-width: 900px) {
  body {
    padding-bottom: 30px;
  }
  .bottom-nav {
    display: none;
  }
  .desktop-nav {
    display: flex;
    gap: 16px;
  }
  .desktop-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
  }
  .desktop-nav a:hover, .desktop-nav a.active {
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.1);
  }
}

@media (max-width: 899px) {
  .desktop-nav {
    display: none;
  }
}
