.stat-team-logo {
  height: 26px;
  width: 44px;
  object-fit: contain;
  object-position: left center;
  vertical-align: middle;
}

.stat-avatar {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  background-color: #e5e7eb;
}

.player-cell {
  text-align: left;
  white-space: nowrap;
}

.player-wrap {
  padding-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

a.player-wrap {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.player-wrap:hover .player-name {
  text-decoration: underline;
}

.team-logo-link {
  display: inline-flex;
  cursor: pointer;
}

/* ============================================================
   INTERACTIVE STAT TABLES (redesigned)
   ============================================================ */
.stats-page { padding-block: 1.5rem 2.5rem; }

.stats-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.stats-title {
  margin: 0;
  font-size: var(--fs-700);
  font-weight: var(--fw-bold);
  text-transform: lowercase;
  line-height: 1;
}
.stats-search { flex: 0 1 340px; min-width: 200px; }
.stats-search-input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-400);
  padding: 0.6rem 0.95rem 0.6rem 2.4rem;
  border: 1px solid var(--color-neutral-300);
  border-radius: 999px;
  background-color: var(--color-neutral-100);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa1ac' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  color: var(--color-neutral-900);
  transition: border-color .15s, box-shadow .15s;
}
.stats-search-input::placeholder { color: var(--color-neutral-600); }
.stats-search-input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgba(229, 28, 53, .15);
}

.stats-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--color-neutral-300);
  border-radius: 0.85rem;
  background: var(--color-neutral-100);
  -webkit-overflow-scrolling: touch;
}

/* Override the fixed 1110px width / padding from style.css */
.stats-table-wrap .table-stats {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: transparent;
  padding: 0;
}

.stat-th {
  background: var(--color-primary-400);
  color: var(--color-neutral-100);
  font-size: var(--fs-400);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .02em;
  padding: 0.75rem 0.6rem;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s;
}
.stat-th:hover,
.stat-th:focus-visible { background: var(--color-primary-600); outline: none; }
.stat-th:first-child { border-top-left-radius: 0.85rem; }
.stat-th:last-child { border-top-right-radius: 0.85rem; }
.stat-th.th-player { text-align: left; }
.stat-th.th-key { background: var(--color-primary-600); }

.th-sort { margin-left: 0.3rem; font-size: 0.8em; display: inline-block; }
.stat-th .th-sort::after { content: "\2195"; opacity: .45; }
.stat-th.asc .th-sort::after { content: "\25B2"; opacity: 1; }
.stat-th.desc .th-sort::after { content: "\25BC"; opacity: 1; }

.stats-table-wrap .table-stats td {
  text-align: center;
  font-size: var(--fs-500);
  color: var(--color-neutral-900);
  border-top: 1px solid var(--color-neutral-300);
  white-space: nowrap;
  line-height: 1.6;
}
.stat-row.row-alt { background: var(--color-neutral-250); }
.stat-row:hover { background: var(--color-primary-100); }

.td-rank { width: 3rem; color: var(--color-neutral-600); font-weight: var(--fw-bold); }
.td-team { width: 56px; }
.td-player { text-align: left; min-width: 160px; font-weight: var(--fw-semi); }
.td-key { background: var(--color-primary-100); color: var(--color-primary-600); font-weight: var(--fw-bold); }

.stats-empty {
  text-align: center;
  padding: 1.6rem 1rem;
  color: var(--color-neutral-600);
  font-size: var(--fs-500);
}

@media (max-width: 50em) {
  .stat-th { font-size: var(--fs-300); padding: 0.6rem 0.5rem; }
  .stats-table-wrap .table-stats td { font-size: var(--fs-300); }
}

/* Left-align team logo + player columns (override the generic centered td rule) */
.stat-th.th-team,
.stat-th.th-player { text-align: left; }
.stats-table-wrap .table-stats td.td-team,
.stats-table-wrap .table-stats td.td-player { text-align: left; }
