:root {
  color-scheme: light;
  --border: #e6e7eb;
  --muted: #68707d;
  --row-hover: #f7f8fa;
  --badge: #c62828;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: #17191c;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.widget {
  width: 100%;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 13px;
  font-weight: 700;
  background: #f5f6f7;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--row-hover);
}

.photo-heading,
.photo-cell {
  width: 58px;
  padding-right: 4px;
}

.player-photo,
.player-placeholder {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.player-photo {
  object-fit: cover;
  background: #eef0f2;
}

.player-placeholder {
  display: grid;
  place-items: center;
  background: #e8eaed;
  color: #5e6670;
  font-size: 12px;
  font-weight: 700;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 63px;
}

.title-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--badge);
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: .02em;
}

.fide-cell {
  width: 120px;
  white-space: nowrap;
}

.fide-cell a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.elo-heading,
.elo-cell {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.elo-cell {
  font-weight: 650;
}

.widget-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  th,
  td {
    padding: 8px;
  }

  .player-photo,
  .player-placeholder {
    width: 36px;
    height: 36px;
  }

  .photo-heading,
  .photo-cell {
    width: 46px;
  }

  .name-cell {
    min-height: 53px;
  }

  .widget-footer {
    flex-direction: column;
    gap: 2px;
  }
}

th.sortable {
  user-select: none;
  white-space: nowrap;
  cursor: pointer;
}

th.sortable .sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

th.sortable .sort-icon {
  font-size: 0.8em;
  opacity: 0.45;
  transition: opacity 0.15s ease;
  cursor: pointer;
}

th.sortable:hover .sort-icon {
  opacity: 0.8;
}

th.sortable[data-sort-direction="asc"] .sort-icon,
th.sortable[data-sort-direction="desc"] .sort-icon {
  opacity: 1;
}
