/* ==========================================================================
   FC Gaia — Estatísticas
   Single stylesheet shared by every page.
   ========================================================================== */

:root {
  --bg:          #0b0d12;
  --bg-2:        #0f1218;
  --card:        #14181f;
  --card-2:      #181d26;
  --line:        #232936;
  --line-soft:   #1b202a;

  --text:        #e9ecf2;
  --muted:       #8d95a6;
  --dim:         #5f6779;

  --brand:       #00c2a8;
  --brand-2:     #00e0c0;
  --brand-dim:   rgba(0, 194, 168, 0.12);
  --accent:      #7c6cff;
  --win:         #2ecc71;
  --loss:        #ff5a6a;
  --warn:        #ffb02e;

  --radius:      14px;
  --radius-sm:   10px;
  --shadow:      0 10px 30px rgba(0, 0, 0, 0.35);
  --nav-h:       60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(0, 194, 168, 0.10), transparent 60%),
    radial-gradient(800px 500px at 90% 0%, rgba(124, 108, 255, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- layout ---------------------------------------------------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.page { padding: 28px 0 80px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap-row { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- top navigation -------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(11, 13, 18, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 100%; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand .crest {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #06110f;
  overflow: hidden;
}
.brand .crest img { width: 100%; height: 100%; object-fit: cover; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

.nav-links { display: flex; gap: 2px; margin-left: 8px; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-links a:hover { background: var(--card); color: var(--text); }
.nav-links a.active { background: var(--brand-dim); color: var(--brand-2); }

.nav-toggle {
  display: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 10px; cursor: pointer;
}

/* ---------- refresh control ------------------------------------------- */

.refresh {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}
.refresh:hover { border-color: var(--brand); color: var(--text); }
.refresh .ico { display: inline-block; width: 14px; height: 14px; }
.refresh.is-loading .ico { animation: spin 0.9s linear infinite; }
.refresh.is-loading { pointer-events: none; opacity: 0.7; }
@keyframes spin { to { transform: rotate(360deg); } }

.stamp { font-size: 12px; color: var(--dim); white-space: nowrap; }

/* ---------- page header ------------------------------------------------ */

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.7rem; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--muted); }

.crumbs { font-size: 13px; color: var(--dim); margin-bottom: 10px; }
.crumbs a:hover { color: var(--brand-2); }

/* ---------- hero -------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(0, 194, 168, 0.14), rgba(124, 108, 255, 0.10) 60%, transparent),
    var(--card);
  padding: 26px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 194, 168, 0.20), transparent 70%);
  pointer-events: none;
}
.hero .logo {
  width: 86px; height: 86px; border-radius: 18px;
  background: var(--card-2); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; flex: none;
}
.hero .logo img { width: 100%; height: 100%; object-fit: contain; }
.hero h1 { margin: 0; font-size: 2rem; letter-spacing: -0.03em; }
.hero .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hero .hero-side { margin-left: auto; text-align: right; }

/* ---------- cards ------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card h2, .card h3 { margin: 0 0 14px; font-size: 1rem; letter-spacing: -0.01em; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 16px 18px; }

.section { margin-top: 26px; }
.section > h2 { font-size: 1.15rem; margin: 0 0 14px; letter-spacing: -0.02em; }

/* ---------- stat tiles -------------------------------------------------- */

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat .bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 10px; overflow: hidden; }
.stat .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 3px; }

/* ---------- badges / pills ---------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--brand-dim); color: var(--brand-2);
}
.badge.win  { background: rgba(46, 204, 113, 0.14); color: var(--win); }
.badge.loss { background: rgba(255, 90, 106, 0.14); color: var(--loss); }
.badge.neutral { background: var(--card-2); color: var(--muted); }
.badge.warn { background: rgba(255, 176, 46, 0.14); color: var(--warn); }
.badge.accent { background: rgba(124, 108, 255, 0.16); color: #a99cff; }

.chip {
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip.active { background: var(--brand-dim); border-color: transparent; color: var(--brand-2); font-weight: 600; }

/* ---------- avatars ----------------------------------------------------- */

.avatar {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--card-2), #202634);
  border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; border-radius: 18px; font-size: 28px; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }

/* ---------- tables ------------------------------------------------------ */

.table-scroll { overflow-x: auto; }

table.stats {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  white-space: nowrap;
}
table.stats th, table.stats td { padding: 10px 10px; text-align: right; border-bottom: 1px solid var(--line-soft); }
table.stats th:first-child, table.stats td:first-child { text-align: left; padding-left: 18px; position: sticky; left: 0; background: var(--card); }
table.stats td:last-child, table.stats th:last-child { padding-right: 18px; }
table.stats thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--card-2);
  color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  cursor: pointer; user-select: none;
}
table.stats thead th:first-child { z-index: 3; background: var(--card-2); }
table.stats thead th:hover { color: var(--text); }
table.stats thead th[data-dir]::after { content: " ↓"; color: var(--brand-2); }
table.stats thead th[data-dir="asc"]::after { content: " ↑"; }
table.stats tbody tr:hover td { background: var(--card-2); }
table.stats tbody tr:hover td:first-child { background: var(--card-2); }
table.stats .player-cell { display: flex; align-items: center; gap: 10px; }
table.stats .player-cell .name { font-weight: 600; }
table.stats .num { color: var(--dim); font-size: 12px; width: 22px; display: inline-block; }
table.stats tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; background: var(--card-2); }
table.stats tfoot td:first-child { background: var(--card-2); }

.pos { color: var(--pos, var(--text)); }
.pos-good { color: var(--win); }
.pos-bad  { color: var(--loss); }

/* ---------- leader / list rows ------------------------------------------ */

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--card-2); }
.list-row .rank { width: 20px; color: var(--dim); font-size: 12px; font-weight: 700; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; }
.list-row .sub { font-size: 12px; color: var(--muted); }
.list-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.list-row .val small { display: block; font-size: 10.5px; color: var(--dim); font-weight: 500; text-align: right; }

/* ---------- game rows ---------------------------------------------------- */

.game {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.game:last-child { border-bottom: 0; }
.game:hover { background: var(--card-2); }
.game .when { width: 96px; flex: none; }
.game .when .d { font-weight: 700; font-size: 13px; }
.game .when .t { font-size: 12px; color: var(--dim); }
.game .versus { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.game .versus .name { font-weight: 600; }
.game .versus .where { font-size: 12px; color: var(--muted); }
.game .result { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }

.next-game { text-align: center; padding: 22px 18px; }
.next-game .countdown { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0; }
.next-game .vs-logos { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0 6px; }
.next-game .vs-logos .avatar { width: 56px; height: 56px; border-radius: 14px; }
.next-game .vs-logos span { color: var(--dim); font-weight: 700; }

/* ---------- opponent cards ----------------------------------------------- */

.team-card {
  display: block;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.team-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.team-card .avatar { width: 52px; height: 52px; border-radius: 14px; }
.team-card h3 { margin: 0; font-size: 1.05rem; }
.team-card .meta { font-size: 12.5px; color: var(--muted); }
.team-card .foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }

/* ---------- inputs -------------------------------------------------------- */

.input {
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; color: var(--text);
  font-size: 13.5px; outline: none; min-width: 180px;
}
.input:focus { border-color: var(--brand); }
.input::placeholder { color: var(--dim); }

/* ---------- misc ---------------------------------------------------------- */

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hidden { display: none !important; }

.placeholder-note {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.012) 10px, rgba(255,255,255,0.012) 20px);
}

.empty { padding: 34px 18px; text-align: center; color: var(--dim); }

.skeleton {
  background: linear-gradient(90deg, var(--card-2) 25%, #1e242f 37%, var(--card-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 6px; color: transparent !important;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.error-banner {
  border: 1px solid rgba(255, 90, 106, 0.35);
  background: rgba(255, 90, 106, 0.08);
  color: #ffc2c8;
  border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; margin-bottom: 16px;
}
.error-banner code { background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 4px; }

.reveal { opacity: 0; transform: translateY(10px); animation: rise 0.45s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

footer.site {
  border-top: 1px solid var(--line-soft);
  padding: 22px 0 40px;
  color: var(--dim);
  font-size: 12.5px;
}
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--brand-2); }

/* ---------- responsive ---------------------------------------------------- */

@media (max-width: 960px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    padding: 8px; margin: 0;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 11px 14px; border-radius: 8px; }
  .stamp { display: none; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 20px; }
  .hero h1 { font-size: 1.5rem; }
  .hero .hero-side { margin-left: 0; text-align: left; }
  .game .when { width: 76px; }
}
