:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #262626;
  --border: #2e2e2e;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --accent: #f97316;
  --accent-2: #e8453c;
  --gradient: linear-gradient(120deg, #ff6a00 0%, #f0582a 55%, #e8403f 100%);
  --ok: #3fb950;
  --error: #f85149;
  --pending: #d29922;
  --male: #5b9bff;
  --female: #f0609e;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

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

p {
  margin: 0;
}

.container {
  max-width: 1156px;
  margin: 0 auto;
  padding: 0 16px;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Cabeçalho ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(22, 22, 22, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 50px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand__logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.auth {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth__email {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Banner ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin-top: 22px;
  padding: 40px 44px;
  border-radius: 14px;
  background: var(--gradient);
  box-shadow: 0 8px 32px rgba(249, 115, 22, 0.25);
  color: #fff;
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 480px;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.9;
}

.hero__title {
  margin: 6px 0 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero__text {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.95;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero__art {
  position: absolute;
  right: 36px;
  top: 50%;
  width: 170px;
  height: 170px;
  transform: translateY(-50%);
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.18;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, background 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--light {
  background: #fff;
  color: var(--accent);
}

.btn--outline {
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
}

.btn--outline:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn--primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 18px rgba(249, 115, 22, 0.35);
}

.btn--primary:hover {
  filter: brightness(1.08);
}

.btn--ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--sm {
  gap: 6px;
  padding: 5px 10px;
  font-size: 0.72rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn--danger:hover {
  color: var(--error);
}

/* ---------- Estatísticas ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 30px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stat__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}

.stat__icon .icon {
  width: 22px;
  height: 22px;
}

.stat__icon--accent {
  background: var(--gradient);
  color: #fff;
}

.stat__label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat__value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

/* ---------- Campeonatos recentes ---------- */
.recent {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 0.82rem;
}

.link .icon {
  width: 12px;
  height: 12px;
}

.link:hover {
  text-decoration: underline;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 56px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  text-align: center;
}

.empty__icon {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty__text {
  margin-top: -4px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------- Rodapé / status da conexão ---------- */
.footer {
  padding-top: 32px;
  padding-bottom: 32px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pending);
}

.status[data-state="ok"]::before { background: var(--ok); }
.status[data-state="error"]::before { background: var(--error); }

/* ---------- Página: cabeçalho ---------- */
.page {
  padding-top: 28px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.page-head__title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-head__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--gradient);
  color: #fff;
}

.page-head__icon .icon {
  width: 20px;
  height: 20px;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Jogadores ---------- */
.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}

.counter {
  padding: 18px 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 10px;
}

.counter__value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1.1;
}

.counter__value--total { color: var(--accent); }
.counter__value--m { color: var(--male); }
.counter__value--f { color: var(--female); }
.counter__value--planejado { color: var(--pending); }
.counter__value--andamento { color: var(--ok); }
.counter__value--encerrado { color: var(--muted); }

.counters--4 {
  grid-template-columns: repeat(4, 1fr);
}

.counter__label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.search {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--accent);
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.list-message {
  margin-top: 16px;
  padding: 36px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.list-message[data-kind="error"] {
  color: var(--error);
}

.players {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-bottom: 16px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px 10px 14px;
  background: var(--surface);
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.07);
}

.player__badge {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.player__badge--m {
  background: rgba(79, 143, 247, 0.18);
  color: var(--male);
}

.player__badge--f {
  background: rgba(240, 96, 158, 0.18);
  color: var(--female);
}

.player__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.player__actions {
  display: flex;
  gap: 2px;
}

/* ---------- Campeonatos ---------- */
.champs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
  padding-bottom: 16px;
}

.recent .champs {
  margin-top: 0;
}

.champ {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 16px 16px;
  background: var(--surface);
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.07);
}

.champ__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.champ__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.champ__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.champ__meta > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.champ__meta .icon {
  width: 14px;
  height: 14px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge--planejado {
  background: rgba(210, 153, 34, 0.15);
  color: var(--pending);
}

.status-badge--andamento {
  background: rgba(63, 185, 80, 0.15);
  color: var(--ok);
}

.status-badge--encerrado {
  background: var(--surface-2);
  color: var(--muted);
}

/* ---------- Popup (dialog) ---------- */
.modal {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > span,
.field > legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.field > span {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 8px;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: rgba(249, 115, 22, 0.15);
  color: var(--text);
  font-weight: 600;
}

.segmented input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.3);
}

.form-error {
  color: var(--error);
  font-size: 0.82rem;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Login ---------- */
/* Página fica oculta até a sessão ser verificada (evita piscar conteúdo protegido). */
body[data-auth="pending"] {
  visibility: hidden;
}

.btn--block {
  justify-content: center;
  width: 100%;
  padding: 11px 14px;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(600px 400px at 50% 0%, rgba(249, 115, 22, 0.18), transparent 70%),
    var(--bg);
}

.login__card {
  width: min(400px, 100%);
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid rgba(249, 115, 22, 0.45);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 24px rgba(249, 115, 22, 0.08);
}

.login__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.login__logo {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
}

.login__logo .icon {
  width: 26px;
  height: 26px;
}

.login__title {
  margin: 14px 0 2px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login__subtitle {
  color: var(--muted);
  font-size: 0.85rem;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .topbar__inner {
    flex-wrap: wrap;
    gap: 4px 12px;
    padding-top: 10px;
    padding-bottom: 6px;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .auth {
    margin-left: auto;
  }

  .stats,
  .players,
  .champs {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .hero {
    padding: 28px 22px;
  }

  .hero__art {
    width: 110px;
    height: 110px;
    right: -10px;
    top: 24px;
    transform: none;
  }

  .stats,
  .players,
  .champs {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .counters {
    gap: 8px;
  }

  .counters--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .segmented {
    grid-auto-flow: row;
  }

  .auth__email {
    display: none;
  }
}
