:root {
  --bg-dark: #071120;
  --card-bg: rgba(7, 21, 41, 0.95);
  --gold: #f4c244;
  --gold-border: #d4a338;
  --gold-glow: rgba(244, 194, 68, 0.4);
  --cyan-glow: #00d2ff;
  --text-white: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Montserrat', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.auth-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.user-greeting,
.menu-details {
  pointer-events: auto;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  margin-left: auto;
  pointer-events: auto;
}

.user-greeting,
.menu-details summary {
  padding: 9px 12px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.menu-details summary {
  cursor: pointer;
  list-style: none;
}

.menu-details summary::-webkit-details-marker {
  display: none;
}

.menu-options {
  min-width: 150px;
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: rgba(7, 21, 41, 0.98);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.menu-options a,
.menu-options button {
  display: block;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-options a:hover,
.menu-options button:hover {
  background: rgba(244, 194, 68, 0.14);
  color: var(--gold);
}

.share-control { position: relative; }
.share-button,
.share-option { font: inherit; cursor: pointer; }
.share-button {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: rgba(7, 21, 41, 0.9);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}
.share-button:hover,
.share-button:focus-visible { color: var(--gold); box-shadow: 0 0 12px rgba(244, 194, 68, 0.2); }
.share-popover {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 12;
  display: grid;
  width: min(230px, calc(100vw - 16px));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  background: rgba(7, 21, 41, 0.98);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}
.menu-options .share-control { margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(212, 163, 56, 0.35); }
.menu-options .share-popover { position: static; width: 100%; margin-top: 6px; box-shadow: none; }
.share-option {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.share-native { background: var(--gold); color: #071120; }
.share-whatsapp { background: #25d366; color: #062b16; }
.share-telegram { background: #229ed9; color: #fff; }
.share-facebook { background: #1877f2; color: #fff; }
.share-copy { background: linear-gradient(110deg, #feda75, #d62976 48%, #4f5bd5); }
.share-option:hover,
.share-option:focus-visible { filter: brightness(1.15); }
.share-feedback { min-height: 16px; color: #a6f0bb; font-size: 0.68rem; font-weight: 700; text-align: center; }

.auth-page {
  justify-content: center;
}

.auth-card,
.logs-card {
  width: min(100%, 560px);
  padding: 28px;
  border: 2px solid var(--gold-border);
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: 0 0 24px rgba(0, 210, 255, 0.18);
}

.auth-logo {
  display: block;
  width: min(65%, 230px);
  margin: 0 auto 14px;
}

.auth-card h1,
.logs-card h1 {
  margin-bottom: 20px;
  color: var(--gold);
  font-size: 1.25rem;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label {
  color: #a9c2e6;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  margin-bottom: 8px;
  padding: 11px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
}

.auth-form button {
  margin-top: 8px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #071120;
  font-weight: 900;
  cursor: pointer;
}

.back-link {
  display: block;
  margin-top: 18px;
  color: #a9c2e6;
  font-size: 0.78rem;
  text-align: center;
}

.flash {
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.flash.erro { background: rgba(200, 55, 55, 0.22); color: #ffb0b0; }
.flash.sucesso { background: rgba(45, 160, 90, 0.22); color: #a6f0bb; }

.logs-card {
  width: min(100%, 1000px);
}

.logs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.logs-header h1 {
  margin: 3px 0 0;
  text-align: left;
}

.eyebrow {
  color: #a9c2e6;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.logs-table-wrapper { overflow-x: auto; }
.logs-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.logs-table th,
.logs-table td { padding: 11px 9px; border-bottom: 1px solid rgba(169, 194, 230, 0.18); text-align: left; }
.logs-table th { color: var(--gold); text-transform: uppercase; }

@media (max-width: 600px) {
  .auth-bar { top: 8px; left: 8px; right: 8px; }
  .header-actions { flex-shrink: 0; }
  .auth-card, .logs-card { padding: 20px 16px; }
  .logs-header { align-items: flex-start; }
  .logs-header h1 { font-size: 1rem; }
}

@media (max-width: 420px) {
  .user-greeting { max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .share-button { padding: 9px 10px; }
  .share-button span { display: none; }
  .share-popover { right: 0; }
}

body {
  background: radial-gradient(circle at center, #0e223d 0%, var(--bg-dark) 100%);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 10px 40px;
}

body.modal-open { overflow: hidden; }

.team-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 18, 0.74);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.team-modal.is-open { opacity: 1; }

.team-modal-content {
  position: relative;
  width: min(100%, 680px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: #0d1b2a;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 24px var(--gold-glow);
  transform: scale(0.92);
  transition: transform 0.22s ease;
}

.team-modal.is-open .team-modal-content { transform: scale(1); }

.team-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
}

.team-modal-close:hover,
.team-modal-close:focus-visible { background: var(--gold); color: #071120; }

.team-modal-heading { padding-right: 40px; margin-bottom: 22px; }
.team-modal-kicker {
  display: block;
  color: #a9c2e6;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.team-modal-heading h2 { margin-top: 5px; color: var(--gold); font-size: 1.45rem; }
.uniform-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.uniform-gallery figure { text-align: center; }
.uniform-image-frame {
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 18px;
  border: 1px solid rgba(244, 194, 68, 0.5);
  border-radius: 10px;
  background: radial-gradient(circle, #173252, #081321 72%);
}
.uniform-image-frame img { width: 100%; height: 210px; object-fit: contain; }
.uniform-gallery figcaption { margin-top: 8px; color: #a9c2e6; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.team-colors { margin-top: 24px; }
.team-color-list { display: flex; gap: 10px; margin-top: 10px; }
.team-color { width: 32px; height: 32px; border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 50%; background: var(--team-color); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.28); }
.team-roster-section { margin-top: 24px; }
.team-roster-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.team-roster-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid rgba(244, 194, 68, 0.3);
  border-radius: 8px;
  background: rgba(244, 194, 68, 0.08);
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.2;
}
.team-roster-name { min-width: 0; overflow-wrap: anywhere; }
.team-roster-cards { display: flex; flex-shrink: 0; gap: 6px; }
.badge-card {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  justify-content: center;
  padding: 4px 6px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}
.badge-card.yellow {
  border-color: rgba(244, 194, 68, 0.45);
  background: rgba(244, 194, 68, 0.15);
  color: var(--gold);
}
.badge-card.red {
  border-color: rgba(220, 53, 69, 0.45);
  background: rgba(220, 53, 69, 0.15);
  color: #ff9da6;
}
.badge-card.is-interactive {
  gap: 5px;
  min-width: 112px;
  padding: 3px 4px;
}
.badge-card-control {
  display: inline-grid;
  width: 21px;
  height: 21px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(7, 17, 32, 0.72);
  color: #fff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.badge-card-control:hover,
.badge-card-control:focus-visible {
  border-color: var(--gold);
  background: rgba(244, 194, 68, 0.22);
  color: var(--gold);
}
.badge-card-control:active { transform: scale(0.92); }
.badge-card-control:disabled { opacity: 0.55; cursor: wait; }
.badge-card.is-interactive [data-card-count] { min-width: 39px; text-align: center; }
.team-roster-list.is-loading,
.team-roster-list.is-empty {
  color: #a9c2e6;
  font-size: 0.78rem;
  line-height: 1.4;
}

.team-row:not(.placeholder),
.standings-table tbody tr { cursor: pointer; }
.team-row:not(.placeholder):hover,
.standings-table tbody tr:hover { background: rgba(244, 194, 68, 0.12); }

/* Cabeçalho */
.header {
  text-align: center;
  margin-bottom: 15px;
}
.header h1 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--gold-glow);
}
.header-brand-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}
.header-logo {
  display: block;
  width: min(45%, 260px);
  height: auto;
  margin: 0 auto;
}
.youtube-live-link {
    position: absolute;
    left: max(0px, calc(50% - min(45%, 260px) / 2 - 158px));
    display: inline-flex;
    flex-direction: column; /* Organiza os itens na vertical */
    align-items: center;    /* Centraliza horizontalmente o ícone e o texto */
    justify-content: center;
    gap: 4px;              /* Espaçamento reduzido entre o ícone e o texto */
    padding: 8px 12px;
    border: 1px solid rgba(255, 0, 0, 0.75);
    border-radius: 8px;
    background: rgba(7, 17, 32, 0.94);
    color: #ff4d4d;
    box-shadow: 0 0 14px rgba(255, 0, 0, 0.2);
    text-align: center;     /* Alinha o texto no centro */
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.youtube-live-link:hover,
.youtube-live-link:focus-visible {
  background: rgba(255, 0, 0, 0.14);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.42);
  transform: translateY(-2px);
}
.youtube-live-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.youtube-live-icon { width: 30px; height: 30px; flex-shrink: 0; }
.youtube-live-link span { display: grid; gap: 2px; }
.youtube-live-link strong { color: #fff; font-size: 0.75rem; letter-spacing: 0.8px; }
.youtube-live-link small { color: #ffb0b0; font-size: 0.58rem; font-weight: 700; white-space: nowrap; }
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 0, 0, 0.2); }
  50% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.42); }
}
.event-date {
  margin-top: 6px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.header h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #a9c2e6;
  letter-spacing: 2px;
  margin-top: 4px;
  text-transform: uppercase;
}
.category-selector {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: #a9c2e6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.category-selector select {
  min-width: 145px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-white);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.category-selector select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Abas de Navegação (Mobile) */
.mobile-tabs {
  display: none;
  gap: 6px;
  width: 100%;
  max-width: 450px;
  margin-bottom: 20px;
  background: rgba(4, 13, 26, 0.9);
  padding: 6px;
  border-radius: 30px;
  border: 1px solid rgba(244, 194, 68, 0.4);
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: #a0aec0;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.25s ease;
}

.tab-btn.active {
  background: var(--gold);
  color: #071120;
  font-weight: 900;
  box-shadow: 0 0 12px var(--gold-glow);
}

/* Estrutura do Torneio */
.bracket-wrapper {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
}

.category-view {
  width: 100%;
  max-width: 900px;
}

.empty-category-view {
  text-align: center;
}

.empty-category-view p {
  color: #a9c2e6;
  font-size: 0.9rem;
  font-weight: 600;
}

.standings-wrapper {
  overflow-x: auto;
  margin-bottom: 24px;
}

.standings-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 2px solid var(--gold-border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.75rem;
}

.standings-table th,
.standings-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(169, 194, 230, 0.18);
  text-align: center;
  white-space: nowrap;
}

.standings-table th {
  color: var(--gold);
  background: rgba(244, 194, 68, 0.1);
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.standings-table tr:last-child td {
  border-bottom: none;
}

.standing-team-name {
  min-width: 180px;
  font-weight: 700;
  text-align: left !important;
}

.standing-team-logo {
  width: 44px;
}

.standing-team-logo img {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  object-fit: contain;
}

.standing-points {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 900;
}

.female-matches-title {
  margin-top: 10px;
}

.female-matches {
  display: grid;
  grid-template-columns: repeat(2, minmax(270px, 1fr));
  gap: 18px;
}

.female-match-title {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.bracket-container {
  display: flex;
  gap: 25px;
  align-items: stretch;
  justify-content: center;
  width: 100%;
}

.round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 20px;
  flex: 1;
  max-width: 320px;
  min-width: 270px;
}

.round-title {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 0 0 8px var(--gold-glow);
}

/* Cards de Partida */
.matchup-card {
  position: relative;
  background: var(--card-bg);
  border: 2px solid var(--gold-border);
  border-radius: 14px;
  padding: 28px 10px 8px;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-time {
  position: absolute;
  top: 7px;
  right: 10px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.team-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.team-badge {
  width: 50px;
  height: 44px;
  border-radius: 44px;
  background: #11253e;
  border: 1.5px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
}

.team-badge img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
}

.team-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.team-row.placeholder .team-name {
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
}

/* Placar */
.score-input {
  width: 44px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  border: 1.5px solid var(--cyan-glow);
  border-radius: 6px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  flex-shrink: 0;
}

.score-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.score-input:disabled {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  opacity: 1;
  cursor: not-allowed;
}

/* Campeão */
.winner-box {
  margin-top: 15px;
  background: linear-gradient(135deg, rgba(244, 194, 68, 0.2), rgba(7, 21, 41, 0.95));
  border: 2px dashed var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
  text-align: center;
  padding: 16px 10px;
  border-radius: 14px;
}

.winner-box .trophy {
  font-size: 2.2rem;
  margin-bottom: 4px;
}

.champion-badge {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.champion-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.winner-name {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--gold);
  margin-top: 4px;
  text-transform: uppercase;
  word-break: break-word;
}

/* Botão Mobile */
.step-nav-btn {
  display: none;
  width: 100%;
  margin-top: 15px;
  padding: 12px;
  background: var(--gold);
  color: #071120;
  font-weight: 900;
  font-size: 0.9rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 0 12px var(--gold-glow);
}

@media (max-width: 860px) {
  .header-brand-row { min-height: 116px; }
  .header-logo { width: min(52%, 220px); }
  .youtube-live-link {
    left: 4px;
    padding: 8px;
  }
  .youtube-live-link small { display: none; }
  .youtube-live-link strong { font-size: 0.68rem; }
  .youtube-live-icon { width: 26px; height: 26px; }

  .mobile-tabs {
    display: flex;
  }

  .bracket-container {
    display: block;
  }

  .female-matches {
    grid-template-columns: 1fr;
  }

  .round {
    display: none !important;
    width: 100%;
    max-width: 100%;
    gap: 14px;
  }

  .round.active-round {
    display: flex !important;
  }

  .round-title {
    display: none;
  }

  .step-nav-btn {
    display: block;
  }

  .team-modal-content { padding: 24px 16px; }
  .uniform-image-frame { min-height: 180px; padding: 10px; }
  .uniform-image-frame img { height: 150px; }
  .team-roster-player { align-items: flex-start; }
  .team-roster-cards { flex-wrap: wrap; justify-content: flex-end; }
}

.players-card {
  width: min(100%, 1050px);
  padding: 28px;
  border: 2px solid var(--gold-border);
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: 0 0 24px rgba(0, 210, 255, 0.18);
}

.players-header,
.players-toolbar,
.player-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.players-header { margin-bottom: 24px; flex-wrap: wrap; }
.players-title-group { margin-right: auto; }
.players-header h1 { margin-top: 4px; color: var(--gold); font-size: 1.4rem; }
.players-back { margin-top: 0; }
.duplicate-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(244, 194, 68, 0.5);
  border-radius: 999px;
  background: rgba(244, 194, 68, 0.14);
  color: var(--gold);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.duplicate-badge > span:first-child {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #071120;
  font-weight: 900;
}
.duplicate-badge.is-clear { border-color: rgba(166, 240, 187, 0.45); background: rgba(166, 240, 187, 0.1); color: #a6f0bb; }
.duplicate-badge.is-clear > span:first-child { background: #a6f0bb; }
.players-toolbar { justify-content: flex-start; margin-bottom: 12px; }
.players-toolbar label { color: #a9c2e6; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.players-toolbar select,
.players-toolbar input,
.player-form input {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font: inherit;
}
.players-filter-field { display: flex; align-items: center; gap: 9px; }
.players-filter-field label { flex-shrink: 0; }
.players-toolbar select { min-width: 260px; }
.players-toolbar input { min-width: 260px; }
.players-search-field { flex: 1; }
.players-search-field input { width: 100%; }
.primary-button,
.secondary-button,
.table-button { border: 0; border-radius: 6px; font: inherit; font-weight: 800; cursor: pointer; }
.primary-button { padding: 11px 16px; background: var(--gold); color: #071120; }
.primary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.secondary-button { padding: 10px 15px; background: rgba(255,255,255,0.08); color: #fff; }
.players-feedback { min-height: 20px; margin: 8px 0; font-size: 0.75rem; font-weight: 700; }
.players-feedback.is-error { color: #ffb0b0; }
.players-feedback.is-success { color: #a6f0bb; }
.players-table-wrapper { overflow-x: auto; }
.players-table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 0.78rem; }
.players-table th, .players-table td { padding: 12px 10px; border-bottom: 1px solid rgba(169, 194, 230, 0.18); text-align: left; }
.players-table th { color: var(--gold); background: rgba(244, 194, 68, 0.1); font-size: 0.68rem; text-transform: uppercase; }

/* Desktop: exibe coluna Nº isolada */
.players-table th.col-num,
.players-table td.player-num-cell {
  text-align: center;
  width: 54px;
  min-width: 54px;
  padding-left: 6px;
  padding-right: 6px;
}
.player-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(244, 194, 68, 0.16);
  color: var(--gold);
  border: 1px solid rgba(244, 194, 68, 0.35);
  font-size: 0.72rem;
  font-weight: 800;
}
.mobile-only-badge {
  display: none !important;
}

.players-table td:not(:first-child) { white-space: nowrap; }
.players-empty { color: #a9c2e6; text-align: center !important; }
.player-actions { display: flex; gap: 7px; }
.card-badge { display: inline-block; min-width: 72px; padding: 4px 7px; border-radius: 5px; font-weight: 800; text-align: center; }
.yellow-card { background: rgba(244, 194, 68, 0.14); color: var(--gold); }
.red-card { background: rgba(220, 70, 70, 0.14); color: #ffb0b0; }
.doc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.doc-badge:hover:not(:disabled) {
  filter: brightness(1.25);
  transform: translateY(-1px);
}
.doc-badge:active:not(:disabled) {
  transform: translateY(0);
}
.doc-badge:disabled {
  opacity: 0.6;
  cursor: wait;
}
.doc-ok {
  background: rgba(46, 204, 113, 0.16);
  color: #3be080;
  border-color: rgba(46, 204, 113, 0.4);
}
.doc-pending {
  background: rgba(231, 76, 60, 0.14);
  color: #ff8b8b;
  border-color: rgba(231, 76, 60, 0.35);
}
.player-checkbox-field {
  margin: 4px 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(169, 194, 230, 0.2);
  border-radius: 8px;
  background: rgba(7, 21, 41, 0.5);
}
.doc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #d7e4f8 !important;
  font-size: 0.8rem !important;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.doc-checkbox-label input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 0 !important;
  accent-color: var(--gold);
  cursor: pointer;
}
.table-button { padding: 7px 9px; background: rgba(244, 194, 68, 0.16); color: var(--gold); font-size: 0.7rem; }
.table-button.danger { background: rgba(220, 70, 70, 0.16); color: #ffb0b0; }
.player-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 18, 0.76); }
.player-modal-content { position: relative; width: min(100%, 520px); padding: 28px; border: 2px solid var(--gold); border-radius: 12px; background: #0d1b2a; box-shadow: 0 18px 60px rgba(0,0,0,0.55); }
.player-modal-content h2 { margin: 5px 0 22px; color: var(--gold); }
.duplicate-modal { position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 18, 0.76); }
.duplicate-modal-content { position: relative; width: min(100%, 560px); max-height: min(720px, 90vh); overflow-y: auto; padding: 28px; border: 2px solid var(--gold); border-radius: 12px; background: #0d1b2a; box-shadow: 0 18px 60px rgba(0,0,0,0.55); }
.duplicate-modal-content h2 { margin: 5px 0 8px; color: var(--gold); }
.duplicate-modal-intro { margin: 0 0 18px; color: #a9c2e6; font-size: 0.82rem; }
.duplicate-list { display: grid; gap: 10px; }
.duplicate-item { padding: 12px 14px; border: 1px solid rgba(244, 194, 68, 0.28); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.duplicate-item strong { display: block; color: #fff; font-size: 0.9rem; }
.duplicate-item span { display: block; margin-top: 5px; color: #a9c2e6; font-size: 0.78rem; }
.duplicate-empty { margin: 0; color: #a6f0bb; font-size: 0.84rem; }
.player-form { display: grid; gap: 8px; }
.player-form label { color: #a9c2e6; font-size: 0.75rem; font-weight: 700; }
.player-form input { width: 100%; margin-bottom: 8px; }
.player-number-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.player-form-actions { justify-content: flex-end; margin-top: 8px; }

.print-sheet { display: none; }

.install-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 680px);
  margin: 24px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(244, 194, 68, 0.55);
  border-radius: 10px;
  background: rgba(7, 21, 41, 0.95);
  box-shadow: 0 0 16px rgba(244, 194, 68, 0.12);
}
.install-banner-icon { color: var(--gold); font-size: 1.55rem; line-height: 1; }
.install-banner-copy { display: grid; flex: 1; gap: 3px; min-width: 0; }
.install-banner-copy strong { color: var(--gold); font-size: 0.82rem; text-transform: uppercase; }
.install-banner-copy span { color: #a9c2e6; font-size: 0.68rem; line-height: 1.3; }
.install-button,
.install-dismiss,
.install-ios-close { border: 0; cursor: pointer; font: inherit; }
.install-button { padding: 9px 13px; border-radius: 6px; background: var(--gold); color: #071120; font-size: 0.72rem; font-weight: 900; }
.install-button:hover,
.install-button:focus-visible { background: #ffe08a; box-shadow: 0 0 12px var(--gold-glow); }
.install-dismiss { padding: 6px; background: transparent; color: #a9c2e6; font-size: 0.8rem; }
.install-dismiss:hover,
.install-dismiss:focus-visible { color: #fff; }
.install-button:focus-visible,
.install-dismiss:focus-visible,
.install-ios-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.install-ios-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 18, 0.78); }
.install-ios-content { position: relative; width: min(100%, 390px); padding: 28px 24px; border: 2px solid var(--gold); border-radius: 12px; background: #0d1b2a; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 24px var(--gold-glow); text-align: center; }
.install-ios-content h2 { margin: 14px 0 10px; color: var(--gold); font-size: 1.1rem; }
.install-ios-content p { color: #d7e4f8; font-size: 0.82rem; line-height: 1.55; }
.install-ios-close { position: absolute; top: 10px; right: 12px; padding: 6px; background: transparent; color: var(--gold); font-size: 1rem; }

@media (max-width: 600px) {
  .players-card { padding: 20px 16px; }
  .players-toolbar { align-items: stretch; flex-direction: column; }
  .players-toolbar select { width: 100%; }
  .player-modal-content { padding: 24px 16px; }
  .install-banner { align-items: flex-start; margin-top: 20px; padding: 11px; }
  .install-banner-copy span { font-size: 0.62rem; }
  .install-button { align-self: center; padding: 8px 10px; }
}

/* Mobile (Celulares): transforma tabela em cards e junta número + nome */
@media (max-width: 768px) {
  .players-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .players-filter-field { align-items: stretch; flex-direction: column; gap: 6px; }
  .players-toolbar select,
  .players-toolbar input,
  .players-toolbar .primary-button { width: 100%; min-width: 0; min-height: 46px; }
  .players-table-wrapper { overflow: visible; }
  .players-table,
  .players-table tbody { display: block; min-width: 0; }
  .players-table thead { display: none; }
  
  .players-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--gold-border);
    border-radius: 10px;
    background: rgba(7, 21, 41, 0.8);
  }
  
  .players-table tbody tr:has(.players-empty) { display: block; }
  .players-table td { display: block; padding: 0; border: 0; white-space: normal; }
  .players-table td::before { display: block; margin-bottom: 4px; color: #a9c2e6; content: attr(data-label); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; }
  
  /* Esconde a célula isolada do número no mobile */
  .players-table td.player-num-cell {
    display: none !important;
  }
  
  /* Alinha a badge do número e o nome na mesma linha horizontal */
  .players-table .player-name-cell {
    grid-column: 1 / -1;
    display: flex !important;
    align-items: center;
    gap: 10px;
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 4px;
  }
  
  .players-table .player-name-cell::before {
    display: none !important;
  }

  /* Mostra a badge do número no cabeçalho do card */
  .players-table .player-name-cell .mobile-only-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(244, 194, 68, 0.18);
    color: var(--gold);
    border: 1px solid var(--gold-border);
    font-size: 0.8rem;
    font-weight: 900;
    flex-shrink: 0;
  }

  .players-table .player-actions::before { display: none; }
  .players-table .player-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
  .table-button { width: 100%; min-height: 44px; }
  .players-table td[data-label="Documento"] .doc-badge { width: 100%; min-height: 38px; }
  .player-modal { padding: 10px; }
  .player-modal-content { width: 95%; max-height: 94vh; overflow-y: auto; }
  .player-form input { min-height: 46px; font-size: 16px; }
  .player-number-fields { gap: 8px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }

  html, body { background: #fff !important; color: #111 !important; }
  body { min-width: 0; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet {
    display: block !important;
    width: 100%;
    color: #111;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
  }
  .print-sheet-header {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) 72px;
    align-items: center;
    min-height: 80px;
    margin-bottom: 12px;
    border-bottom: 2px solid #111;
  }
  .print-tournament-logo,
  .print-team-logo { width: 72px; height: 72px; object-fit: contain; }
  .print-sheet-header > div { padding: 0 14px; }
  .print-sheet-tournament { margin: 0 0 5px; font-size: 12pt; font-weight: 800; letter-spacing: 0.5px; }
  .print-sheet-header h1 { margin: 0; font-size: 18pt; }
  .print-sheet-header p:last-child { margin: 4px 0 8px; font-size: 11pt; }
  .print-roster-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-roster-table th,
  .print-roster-table td { border: 1px solid #000; padding: 5px 6px; }
  .print-roster-table th { background: #e9e9e9; font-size: 8.5pt; text-align: center; }
  .print-roster-table td { height: 25px; }
  .print-roster-table th:nth-child(1), .print-roster-table td:nth-child(1) { width: 8%; text-align: center; }
  .print-roster-table th:nth-child(2), .print-roster-table td:nth-child(2) { width: 35%; text-align: left; }
  .print-roster-table th:nth-child(3), .print-roster-table td:nth-child(3) { width: 22%; text-align: center; }
  .print-roster-table th:nth-child(4), .print-roster-table td:nth-child(4) { width: 35%; }
  .print-consent { margin-top: 12px; padding: 9px 10px; border: 1px solid #000; font-size: 8.5pt; line-height: 1.3; }
  .print-consent h2 { margin: 0 0 6px; font-size: 9.5pt; }
  .print-consent p { margin: 4px 0; }
  .print-signature-fields { display: flex; justify-content: space-between; gap: 16px; margin-top: 18px; font-size: 9pt; }
}