/* ============================================================
   Theme Variables
   ============================================================ */
:root {
  /* Brasil colors (tema claro) */
  --green: #009c3b;
  --green-dark: #00702a;
  --green-light: #00b347;
  --yellow: #ffdf00;
  --yellow-dark: #f5c500;

  /* Background */
  --bg-grad-start: #fffae6;
  --bg-grad-mid: #fff8db;
  --bg-grad-end: #f5f5f5;
  --surface: #ffffff;
  --surface-alt: #fafaf2;
  --surface-2: #f5f5e8;
  --surface-3: #ebebe3;
  --border: #e0e0d0;
  --border-soft: #ececd8;
  --text: #1a1a1a;
  --text-soft: #555;
  --text-muted: #888;
  --text-dim: #aaa;
  --shadow-soft: 0 20px 60px -20px rgba(0, 156, 59, 0.25);
  --shadow-card: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
  --pitch-bg-1: #2e8b3a;
  --pitch-bg-2: #1f6f29;
  --pattern-color: #f4f4f0;
  --pattern-color-2: #ebebe3;
  --flag-stripe-bg: #fff;

  /* Overall tiers */
  --tier-elite: #e53935;       /* 90+ */
  --tier-top: #d4a300;          /* 80-89 */
  --tier-good: #009c3b;         /* 70-79 */
  --tier-mid: #1e88e5;          /* 60-69 */
  --tier-low: #888;             /* <60 */
}

[data-theme="dark"] {
  --bg-grad-start: #0a1612;
  --bg-grad-mid: #0f1f1a;
  --bg-grad-end: #050a08;
  --surface: #16221c;
  --surface-alt: #1a2820;
  --surface-2: #1f2e25;
  --surface-3: #0e1a14;
  --border: #2a3a2f;
  --border-soft: #1f2e25;
  --text: #e8e8e8;
  --text-soft: #b8c0b8;
  --text-muted: #7a8a7e;
  --text-dim: #5a6a5e;
  --shadow-soft: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 2px 8px -2px rgba(0, 0, 0, 0.3);
  --pitch-bg-1: #1a4a20;
  --pitch-bg-2: #0d2a12;
  --pattern-color: #0e1a14;
  --pattern-color-2: #16221c;
  --flag-stripe-bg: #0a1612;

  /* Tiers (mais vibrantes no dark) */
  --tier-elite: #ff5252;
  --tier-top: #ffd740;
  --tier-good: #4caf50;
  --tier-mid: #42a5f5;
  --tier-low: #9e9e9e;
}

/* ============================================================
   Reset & Base
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  width: 100%;
}

html {
  /* Rede de segurança: impede qualquer overflow horizontal
     residual de criar barra de scroll no <html>. */
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse at top, var(--bg-grad-start) 0%, var(--bg-grad-mid) 35%, var(--bg-grad-end) 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  padding: 24px;
  display: flex;
  flex-direction: column;
  /* stretch (default) em mobile: impede que filhos maiores que o body
     sejam centralizados pelo align-items: center e cortem nas laterais. */
  align-items: stretch;
  gap: 36px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Em desktop, centraliza os filhos com max-width (container, ad, game) */
@media (min-width: 601px) {
  body {
    align-items: center;
  }
}

/* ============================================================
   Brasil flag accent stripes
   ============================================================ */
.flag-stripe {
  position: fixed;
  left: 0;
  width: 100%;
  height: 14px;
  z-index: 1;
  transition: background 0.3s ease;
}
.flag-stripe.top {
  top: 0;
  background: linear-gradient(90deg, var(--green) 50%, var(--yellow) 50%);
}
.flag-stripe.bottom {
  bottom: 0;
  background: linear-gradient(90deg, var(--green) 50%, var(--yellow) 50%);
}

/* ============================================================
   Site Footer (crédito)
   ============================================================ */
.site-footer {
  width: 100%;
  max-width: 960px;
  padding: 20px 12px 8px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  position: relative;
  z-index: 2;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px dotted var(--green);
  padding-bottom: 1px;
  transition: all 0.15s ease;
}

.site-footer a:hover {
  color: var(--green-dark);
  border-bottom-color: var(--green-dark);
  border-bottom-style: solid;
}

[data-theme="dark"] .site-footer a {
  color: var(--green-light);
  border-bottom-color: var(--green-light);
}

[data-theme="dark"] .site-footer a:hover {
  color: var(--yellow);
  border-bottom-color: var(--yellow);
}

/* ============================================================
   Theme toggle (claro/escuro)
   ============================================================ */
.theme-toggle {
  position: fixed;
  top: 26px;
  right: 26px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}
.theme-toggle:hover {
  transform: scale(1.05) rotate(15deg);
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.25);
}
.theme-toggle .theme-icon-light { display: inline; }
.theme-toggle .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-dark { display: inline; }

/* ============================================================
   HERO (contagem)
   ============================================================ */
.container {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: 16px 0;
}

.shield {
  width: 180px;
  height: auto;
  margin-bottom: 24px;
  filter: drop-shadow(0 6px 14px rgba(0, 156, 59, 0.25));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title {
  font-family: 'Anton', 'Inter', sans-serif;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 0.95;
  margin-bottom: 18px;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.title-line {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: var(--green);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.title-main {
  font-size: clamp(5rem, 16vw, 10rem);
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 0 rgba(0, 156, 59, 0.15);
  line-height: 0.9;
}

.subtitle {
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  color: var(--text-soft);
  margin-bottom: 32px;
  font-weight: 500;
}

.subtitle strong {
  color: var(--green);
  font-weight: 800;
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vw, 18px);
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(0, 156, 59, 0.2);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 3vw, 28px);
  box-shadow:
    0 20px 60px -20px rgba(0, 156, 59, 0.25),
    0 0 0 1px rgba(255, 223, 0, 0.3) inset;
}

[data-theme="dark"] .countdown {
  background: rgba(22, 34, 28, 0.7);
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.time-value {
  font-family: 'Anton', sans-serif;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1;
  color: var(--green);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(255, 223, 0, 0.5);
  min-width: 1.8em;
  text-align: center;
}

.time-label {
  margin-top: 8px;
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.separator {
  font-family: 'Anton', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--yellow);
  -webkit-text-stroke: 1px var(--green);
  text-stroke: 1px var(--green);
  font-weight: 400;
  align-self: flex-start;
  margin-top: 4px;
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.footer {
  margin-top: 32px;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ============================================================
   AD SECTION
   ============================================================ */
.ad-section {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.ad-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-weight: 600;
}

.ad-placeholder {
  width: 100%;
  max-width: 728px;
  min-height: 120px;
  background: repeating-linear-gradient(
    45deg,
    var(--pattern-color),
    var(--pattern-color) 12px,
    var(--pattern-color-2) 12px,
    var(--pattern-color-2) 24px
  );
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ad-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-align: center;
}

.ad-icon { font-size: 1.6rem; }

.ad-text {
  font-weight: 700;
  font-size: 0.95rem;
}

.ad-hint {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ============================================================
   GAME SECTION
   ============================================================ */
.game-section {
  width: 100%;
  max-width: 1200px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(0, 156, 59, 0.2);
  border-radius: 28px;
  padding: clamp(20px, 3vw, 36px);
  box-shadow: 0 20px 60px -20px rgba(0, 156, 59, 0.25);
  position: relative;
  z-index: 2;
}

[data-theme="dark"] .game-section {
  background: rgba(22, 34, 28, 0.85);
  border-color: rgba(0, 179, 71, 0.3);
}

.game-header {
  text-align: center;
  margin-bottom: 24px;
}

.game-header h2 {
  font-family: 'Anton', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.game-header h2 span {
  color: var(--green);
  -webkit-text-stroke: 1px var(--yellow);
  text-stroke: 1px var(--yellow);
}

.game-header p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ----- Formation bar ----- */
.formation-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  background: linear-gradient(90deg, rgba(0, 156, 59, 0.08), rgba(255, 223, 0, 0.12));
  border-radius: 14px;
}

.formation-label {
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.formation-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.formation-btn {
  font-family: 'Anton', sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text-soft);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.formation-btn:hover {
  border-color: var(--green);
  color: var(--green);
  transform: translateY(-1px);
}

.formation-btn.active {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: var(--yellow);
  border-color: var(--green);
  box-shadow: 0 4px 12px -4px rgba(0, 156, 59, 0.5);
}

/* ----- Game grid ----- */
.game-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
}

@media (max-width: 880px) {
  .game-grid {
    /* minmax(0, 1fr) impede que o conteúdo force a coluna
       a estourar a largura do container (causa raiz do overflow). */
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ----- Player pool (esquerda) ----- */
.player-pool {
  background: var(--surface-alt);
  border: 1.5px solid var(--border-soft);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  max-height: 720px;
  /* min-width: 0 impede o item do grid de estourar a coluna */
  min-width: 0;
}

.pool-header h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#pool-count {
  background: var(--green);
  color: var(--yellow);
  font-family: 'Anton', sans-serif;
  font-size: 0.85rem;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* ----- Search ----- */
.pool-search {
  position: relative;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}

.pool-search .search-icon {
  position: absolute;
  left: 10px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.6;
}

.pool-search-input {
  flex: 1;
  padding: 8px 32px 8px 32px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pool-search-input::placeholder { color: var(--text-dim); }

.pool-search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 156, 59, 0.15);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.search-clear.show { display: flex; }
.search-clear:hover { background: var(--text-muted); color: var(--surface); }

.pool-filters {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.12s ease;
}

.filter-btn:hover { border-color: var(--green); color: var(--green); }

.filter-btn.active {
  background: var(--green);
  color: var(--yellow);
  border-color: var(--green);
}

.player-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #009c3b #e0e0c8;
}

.player-list::-webkit-scrollbar { width: 6px; }
.player-list::-webkit-scrollbar-track { background: var(--border); border-radius: 3px; }
.player-list::-webkit-scrollbar-thumb { background: var(--green); border-radius: 3px; }

/* Section header (quando filtrando por slot) */
.list-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  background: var(--surface);
  border-radius: 8px;
  border: 1px dashed var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.list-section-header .count {
  margin-left: auto;
  background: var(--green);
  color: var(--yellow);
  font-family: 'Anton', sans-serif;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
}
.list-section-header .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.list-section-header .dot.pos-GOL { background: #f5c500; }
.list-section-header .dot.pos-ZAG { background: #0d47a1; }
.list-section-header .dot.pos-LD  { background: #00695c; }
.list-section-header .dot.pos-LE  { background: #1b5e20; }
.list-section-header .dot.pos-VOL { background: #e65100; }
.list-section-header .dot.pos-MEI { background: #4a148c; }
.list-section-header .dot.pos-ATA { background: #b71c1c; }

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}

.player-card:hover:not(:disabled) {
  border-color: var(--green);
  transform: translateX(2px);
  box-shadow: 0 2px 8px -2px rgba(0, 156, 59, 0.3);
}

.player-card.selected {
  background: linear-gradient(90deg, rgba(255, 251, 230, 0.7), rgba(255, 245, 204, 0.7));
  border-color: var(--yellow);
  opacity: 0.6;
  cursor: not-allowed;
}

[data-theme="dark"] .player-card.selected {
  background: linear-gradient(90deg, rgba(255, 251, 230, 0.05), rgba(255, 245, 204, 0.1));
}

.player-card:disabled {
  cursor: not-allowed;
}

.player-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #aaa, #888);
  overflow: hidden;
}

.player-avatar.has-photo {
  object-fit: cover;
  background: var(--surface-2);
  border: 1.5px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Overall badge (no card da lista) */
.player-overall {
  font-family: 'Anton', sans-serif;
  font-size: 0.85rem;
  padding: 2px 7px;
  border-radius: 4px;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  min-width: 32px;
  text-align: center;
}

.player-overall.tier-elite { background: var(--tier-elite); }
.player-overall.tier-top   { background: var(--tier-top); color: #1a1a1a; }
.player-overall.tier-good  { background: var(--tier-good); }
.player-overall.tier-mid   { background: var(--tier-mid); }
.player-overall.tier-low   { background: var(--tier-low); }

.player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta {
  font-size: 0.72rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-pos {
  font-family: 'Anton', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: 4px;
  background: #f0f0e0;
  color: #555;
  flex-shrink: 0;
}

/* Cores por posição (avatar e badge) */
.pos-GOL .player-avatar { background: linear-gradient(135deg, #f5c500, #d4a800); color: #1a1a1a; }
.pos-GOL .player-pos { background: #fff4cc; color: #8a7000; }
.pos-ZAG .player-avatar { background: linear-gradient(135deg, #1e88e5, #0d47a1); }
.pos-ZAG .player-pos { background: #d6e9f8; color: #0d47a1; }
.pos-LD  .player-avatar { background: linear-gradient(135deg, #26a69a, #00695c); }
.pos-LD  .player-pos { background: #d3efed; color: #00695c; }
.pos-LE  .player-avatar { background: linear-gradient(135deg, #43a047, #1b5e20); }
.pos-LE  .player-pos { background: #d8efd9; color: #1b5e20; }
.pos-VOL .player-avatar { background: linear-gradient(135deg, #fb8c00, #e65100); }
.pos-VOL .player-pos { background: #ffe5cc; color: #e65100; }
.pos-MEI .player-avatar { background: linear-gradient(135deg, #8e24aa, #4a148c); }
.pos-MEI .player-pos { background: #ecd9f0; color: #4a148c; }
.pos-ATA .player-avatar { background: linear-gradient(135deg, #e53935, #b71c1c); }
.pos-ATA .player-pos { background: #ffd9d6; color: #b71c1c; }

/* ----- Pitch (campo) ----- */
.pitch-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.pitch {
  background: var(--surface);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 0 0 2px rgba(0, 156, 59, 0.2);
}

.pitch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 10px;
  gap: 10px;
}

.pitch-shield {
  width: 38px;
  height: auto;
}

.pitch-title {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.pitch-title strong {
  font-family: 'Anton', sans-serif;
  font-size: 1.4rem;
  color: var(--green);
  letter-spacing: 0.12em;
}

.pitch-title span {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.pitch-credits {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
  max-width: 100px;
  line-height: 1.1;
}

.pitch-field {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  background:
    radial-gradient(circle at 50% 50%, var(--pitch-bg-1) 0%, var(--pitch-bg-2) 100%);
  border-radius: 10px;
  border: 3px solid #fff;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Linhas do campo */
.pitch-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.center-line { left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-1px); }
.center-circle {
  width: 30%;
  aspect-ratio: 1;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  border-radius: 50%;
}
.penalty-top {
  top: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 22%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-top: none;
  background: rgba(255, 255, 255, 0.05);
}
.penalty-bottom {
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 60%; height: 22%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.05);
}
.goal-top {
  top: 0; left: 50%; transform: translateX(-50%);
  width: 30%; height: 4%;
  background: rgba(255, 255, 255, 0.95);
}
.goal-bottom {
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 30%; height: 4%;
  background: rgba(255, 255, 255, 0.95);
}

/* Slot de jogador no campo */
.slot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s ease;
}

.slot:hover { transform: translate(-50%, -50%) scale(1.06); }

.slot-avatar {
  width: clamp(38px, 7vw, 56px);
  height: clamp(38px, 7vw, 56px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(0.7rem, 1.6vw, 0.9rem);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #aaa, #888);
  letter-spacing: 0.05em;
  overflow: hidden;
}

.slot-avatar.has-photo {
  object-fit: cover;
  background: #444;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 0 2px #fff,
    0 0 0 4px var(--green);
}

.slot-avatar.empty-plus {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.7);
}

/* Slot overall badge */
.slot-overall {
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-family: 'Anton', sans-serif;
  font-size: clamp(0.55rem, 1.4vw, 0.75rem);
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  color: #fff;
  border: 1.5px solid #fff;
  line-height: 1.1;
  min-width: 22px;
  text-align: center;
}

.slot-overall.tier-elite { background: var(--tier-elite); }
.slot-overall.tier-top   { background: var(--tier-top); color: #1a1a1a; }
.slot-overall.tier-good  { background: var(--tier-good); }
.slot-overall.tier-mid   { background: var(--tier-mid); }
.slot-overall.tier-low   { background: var(--tier-low); }

.slot-name {
  font-size: clamp(0.6rem, 1.4vw, 0.75rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-pos {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Anton', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  background: #ffdf00;
  color: #009c3b;
  border-radius: 3px;
  border: 1px solid #009c3b;
  pointer-events: none;
}

/* Slot vazio: mostra só a posição */
.slot.empty .slot-avatar {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.7);
}

.slot.empty .slot-name { display: none; }
.slot.empty .slot-pos {
  position: static;
  transform: none;
  font-size: 0.7rem;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.9);
  color: #009c3b;
  border: 1.5px solid #009c3b;
}

.slot.active-pick {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Shake animation (incompatibilidade) */
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%); }
  10%, 30%, 50%, 70%, 90% { transform: translate(calc(-50% - 4px), -50%); }
  20%, 40%, 60%, 80% { transform: translate(calc(-50% + 4px), -50%); }
}

.slot.shake {
  animation: shake 0.45s ease-in-out;
}

.pitch-footer {
  margin-top: 10px;
  padding: 6px 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pitch-hint {
  display: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green);
  background: linear-gradient(90deg, #fffbe6, #fff5cc);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--yellow);
  animation: hintIn 0.25s ease;
}

[data-theme="dark"] .pitch-hint {
  background: linear-gradient(90deg, rgba(255, 251, 230, 0.1), rgba(255, 245, 204, 0.15));
}

.pitch-hint.show { display: inline-block; }
.pitch-hint strong { color: #b71c1c; }

@keyframes hintIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Power indicator */
.pitch-power {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(0, 156, 59, 0.08), rgba(255, 223, 0, 0.12));
  border: 1.5px solid var(--green);
  margin-top: 4px;
  flex-wrap: wrap;
}

.pitch-power.show { display: flex; }

.power-label {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
}

.power-value {
  font-family: 'Anton', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border-radius: 4px;
  color: #fff;
  min-width: 52px;
  text-align: center;
  line-height: 1.1;
}

.power-value.tier-elite { background: var(--tier-elite); }
.power-value.tier-top   { background: var(--tier-top); color: #1a1a1a; }
.power-value.tier-good  { background: var(--tier-good); }
.power-value.tier-mid   { background: var(--tier-mid); }
.power-value.tier-low   { background: var(--tier-low); }

.power-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ----- Actions ----- */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(18, 140, 126, 0.5);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px -4px rgba(18, 140, 126, 0.6);
}
.btn-primary:disabled {
  background: #cccccc;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  background: var(--surface);
  color: var(--green);
  border: 2px solid var(--green);
}
.btn-secondary:hover { background: rgba(0, 156, 59, 0.08); }

.btn-accent {
  background: linear-gradient(135deg, #ffd54f, #ffa726);
  color: #1a1a1a;
  border: 2px solid #f57c00;
  box-shadow: 0 4px 14px -4px rgba(245, 124, 0, 0.5);
}
.btn-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px -4px rgba(245, 124, 0, 0.65);
  background: linear-gradient(135deg, #ffca28, #fb8c00);
}
.btn-accent:active:not(:disabled) { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s ease;
}
.btn-ghost.show {
  opacity: 1;
  pointer-events: auto;
  border-color: var(--border);
  color: #b71c1c;
}
.btn-ghost.show:hover {
  background: rgba(183, 28, 28, 0.08);
  border-color: #b71c1c;
}

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

/* ============================================================
   SHARE MODAL
   ============================================================ */
.share-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.share-modal.open {
  display: flex;
}

.share-modal-content {
  background: var(--surface);
  border-radius: 18px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}

.share-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
}
.share-modal-close:hover { color: var(--text); }

.share-modal h3 {
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  color: var(--green);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.share-modal p {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.share-preview {
  background: var(--surface-2);
  padding: 8px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
}

.share-preview canvas,
.share-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.share-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ----- Toasts ----- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ----- Responsivo ----- */
@media (min-width: 881px) {
  /* Em desktop, o campo fica mais compacto (não ocupa toda a coluna) */
  .pitch-wrapper {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
  }
  .pitch-field { aspect-ratio: 3 / 4; }
  .slot-avatar { width: 44px; height: 44px; font-size: 0.7rem; }
  .slot-name { font-size: 0.65rem; max-width: 72px; padding: 0 4px; }
  .slot-pos { font-size: 0.65rem; padding: 1px 5px; }
  .slot-overall { font-size: 0.6rem; min-width: 20px; padding: 0 4px; }
  .pitch-title strong { font-size: 1.2rem; }
  .pitch-title span { font-size: 0.75rem; }
}

@media (max-width: 880px) {
  /* Game grid vira coluna */
  .game-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  /* Body mais compacto */
  body {
    padding: 12px;
    gap: 20px;
  }

  /* Hero mais enxuto */
  .shield { width: 130px; margin-bottom: 16px; }
  .title { gap: 0; margin-bottom: 12px; }
  .title-line { font-size: 1.3rem; letter-spacing: 0.15em; }
  .title-main { font-size: 4.5rem; }
  .subtitle { font-size: 0.9rem; margin-bottom: 18px; }
  .footer { font-size: 0.95rem; margin-top: 18px; text-align: center; }

  /* Contagem: 4 blocos em grid 4 colunas iguais (sem wrap) */
  .countdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 14px 8px;
    width: 100%;
    box-sizing: border-box;
  }
  .countdown .separator { display: none; }
  .time-block {
    min-width: 0;
    width: 100%;
  }
  .time-value {
    font-size: clamp(1.5rem, 7vw, 2rem);
    min-width: 0;
  }
  .time-label {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    margin-top: 4px;
  }

  /* Ad slot */
  .ad-section { gap: 6px; }
  .ad-placeholder { min-height: 80px; }

  /* Game section */
  .game-section { padding: 14px; border-radius: 20px; }
  .game-header h2 { font-size: 1.4rem; }
  .game-header p { font-size: 0.85rem; }

  /* Formation bar */
  .formation-bar { gap: 8px; padding: 10px; }
  .formation-label { font-size: 0.75rem; }
  .formation-options { gap: 4px; justify-content: center; }
  .formation-btn { padding: 6px 10px; font-size: 0.95rem; }

  /* Player pool */
  .player-pool {
    padding: 10px;
    max-height: 540px;
  }
  .pool-header h3 { font-size: 0.85rem; }
  #pool-count { font-size: 0.75rem; padding: 1px 5px; }

  /* Player card mais compacto */
  .player-card { padding: 6px 8px; gap: 8px; }
  .player-avatar { width: 32px; height: 32px; font-size: 0.7rem; }
  .player-name { font-size: 0.8rem; }
  .player-meta { font-size: 0.65rem; }
  .player-pos { font-size: 0.65rem; padding: 2px 5px; }
  .player-overall { font-size: 0.75rem; padding: 1px 5px; min-width: 26px; }

  /* Pitch mais quadrado em mobile */
  .pitch { padding: 10px; }
  .pitch-header { padding: 2px 4px 8px; }
  .pitch-shield { width: 30px; }
  .pitch-title strong { font-size: 1.1rem; }
  .pitch-title span { font-size: 0.7rem; }
  .pitch-credits { font-size: 0.6rem; max-width: 70px; }
  .pitch-field { aspect-ratio: 4 / 5; }
  .slot-avatar { width: 36px; height: 36px; font-size: 0.65rem; }
  .slot-name { font-size: 0.55rem; max-width: 60px; padding: 0 4px; }
  .slot-overall { font-size: 0.55rem; min-width: 18px; padding: 0 3px; bottom: 0; right: 0; }
  .slot-pos { font-size: 0.6rem; padding: 1px 4px; }

  .pitch-footer { font-size: 0.75rem; padding: 6px; }
  .pitch-hint { font-size: 0.75rem; padding: 3px 8px; }
  .pitch-power { font-size: 0.75rem; padding: 4px 8px; gap: 4px; }
  .power-label { font-size: 0.7rem; }
  .power-value { font-size: 1.1rem; padding: 1px 6px; min-width: 40px; }
  .power-hint { font-size: 0.6rem; }

  /* Ações: botões em coluna, full width */
  .actions {
    flex-direction: column;
    gap: 8px;
  }
  .actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* Theme toggle menor */
  .theme-toggle {
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  /* Share modal em mobile */
  .share-modal-content {
    padding: 18px 14px;
    max-height: 92vh;
  }
  .share-modal h3 { font-size: 1.2rem; }
  .share-modal p { font-size: 0.8rem; }
  .share-actions { flex-direction: column; }
  .share-actions .btn { width: 100%; }
}

@media (max-width: 380px) {
  /* Telas muito pequenas (iPhone SE antigo) */
  .title-main { font-size: 3.6rem; }
  .time-value { font-size: 1.4rem; }
  .time-label { font-size: 0.5rem; }
  .player-pool { max-height: 460px; }
}
