/* Compact statistical tables inspired by Sofascore; existing ranking calculations retained. */
html[data-theme="dark"] .rankings-page { max-width: 1080px; margin: 0 auto; }
html[data-theme="dark"] .rankings-page .page-header { padding: 4px 0 24px; margin-bottom: 0; }
html[data-theme="dark"] .rankings-page .page-title { font-size: 32px; font-weight: 700; letter-spacing: -1px; }
html[data-theme="dark"] .rankings-page .page-subtitle { color: #a0a0a0; font-size: 13px; margin-top: 7px; }
html[data-theme="dark"] .rankings-page .tab-nav {
  display: flex;
  gap: 28px;
  padding: 0;
  margin-bottom: 22px;
  border: 0;
  border-bottom: 1px solid #3a3a3a;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
html[data-theme="dark"] .rankings-page .tab-btn {
  min-height: 48px;
  padding: 0 2px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #a9a9a9;
}
html[data-theme="dark"] .rankings-page .tab-btn.active { color: #c6c6c6; border-bottom-color: #969696; background: transparent; }
html[data-theme="dark"] .rankings-page .tab-btn:hover { color: #e5e5e5; background: transparent; }
html[data-theme="dark"] .rankings-page .tab-btn svg { width: 16px; height: 16px; }
html[data-theme="dark"] .rankings-page .matches-toolbar { margin-bottom: 18px; }
html[data-theme="dark"] .rankings-page .matches-filter-group { gap: 6px; padding: 0; background: transparent; border: 0; }
html[data-theme="dark"] .rankings-page .filter-btn { color: #b4b4b4; background: #151515; border: 1px solid #404040; padding: 8px 13px; font-size: 12px; font-weight: 500; }
html[data-theme="dark"] .rankings-page .filter-btn.active { background: #3a3a3a; border-color: #767676; color: #d8d8d8; box-shadow: none; }
html[data-theme="dark"] .rankings-page .filter-count { background: transparent; color: #a5a5a5; font-size: 10px; }
html[data-theme="dark"] .rankings-page .rankings-group-sub { text-align: left; font-weight: 400; font-size: 12px; color: #9e9e9e; }
html[data-theme="dark"] .rankings-page .table-wrap { background: #131313; border: 1px solid #303030; border-radius: 10px; overflow-x: auto; }
html[data-theme="dark"] .rankings-page .table { width: 100%; display: table; border-collapse: collapse; font-size: 13px; }
html[data-theme="dark"] .rankings-page .table thead { display: table-header-group; background: #1c1c1c; }
html[data-theme="dark"] .rankings-page .table tbody { display: table-row-group; }
html[data-theme="dark"] .rankings-page .table tr { display: table-row; }
html[data-theme="dark"] .rankings-page .table th {
  display: table-cell;
  height: 42px;
  padding: 10px 16px;
  color: #ababab;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  background: #1c1c1c;
}
html[data-theme="dark"] .rankings-page .table td {
  display: table-cell;
  height: 60px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid #343434;
  vertical-align: middle;
  color: #c6c6c6;
  background: transparent;
  border-radius: 0;
}
html[data-theme="dark"] .rankings-page .table tbody tr,
html[data-theme="dark"] .rankings-page .table tbody tr:nth-child(even) { background: #131313; }
html[data-theme="dark"] .rankings-page .table tbody tr:hover { background: #232323; }
html[data-theme="dark"] .rankings-page .table td::before { content: none; }
html[data-theme="dark"] .rankings-page .table .pos-cell { width: 48px; min-width: 48px; text-align: center; }
.rk-rank { display: inline; font-family: var(--font-data); font-variant-numeric: tabular-nums; font-weight: 400; font-size: 13px; color: #aaaaaa; }
html[data-theme="dark"] .rankings-page .table :is(th.stat-cell, td.stat-cell) { text-align: center; min-width: 46px; font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .rankings-page .table td.stat-cell.points { background: transparent; color: #efefef; font-size: 15px; font-weight: 700; border-radius: 0; }
html[data-theme="dark"] .rankings-page .table tbody tr:first-child > td:first-child { box-shadow: inset 3px 0 #919191; }
html[data-theme="dark"] .rankings-page .table td.team-cell { white-space: nowrap; }
html[data-theme="dark"] .rankings-page .table td.team-cell > .team-emblem { display: inline-flex !important; width: 28px; height: 28px; vertical-align: middle; margin-right: 11px; }
html[data-theme="dark"] .rankings-page .table td.team-cell > div:not(.team-emblem) { display: inline-block; vertical-align: middle; }
html[data-theme="dark"] .rankings-page .table .team-name { font-size: 14px; font-weight: 500; color: #e7e7e7; }
html[data-theme="dark"] .rankings-page .table .team-category { font-size: 11px; font-weight: 400; color: #999999; margin-top: 3px; }
.rk-player { display: flex; align-items: center; gap: 12px; }
.rk-team-mark { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; flex-shrink: 0; }
.rk-player-copy { display: flex; flex-direction: column; gap: 4px; }
.rk-player-name { font-size: 14px; font-weight: 500; color: #e7e7e7; line-height: 1.35; }
.rk-player-team { font-size: 11px; font-weight: 400; color: #a2a2a2; line-height: 1.35; }
.rk-goals { color: #e9e9e9; font-size: 17px; font-weight: 700; font-family: var(--font-data); font-variant-numeric: tabular-nums; }
html[data-theme="dark"] .rk-scorers .table :is(th:last-child, td:last-child) { width: 92px; }
html[data-theme="dark"] .rk-scorers .table .col-name { min-width: 0; }
.rk-mobile-form { display: none; }
.rk-form { width: 20px !important; height: 20px !important; border-radius: 4px !important; box-shadow: none !important; border: none !important; font-family: var(--font-data); font-size: 10px !important; font-weight: 600 !important; }
.rk-form.is-win { background: #225640 !important; color: #a7edc8 !important; }
.rk-form.is-draw { background: #494949 !important; color: #e1e1e1 !important; }
.rk-form.is-loss { background: #66303d !important; color: #ffbdc7 !important; }
@media (max-width: 720px) {
  html[data-theme="dark"] .rankings-page .page-title { font-size: 28px; }
  html[data-theme="dark"] .rankings-page .tab-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  html[data-theme="dark"] .rankings-page .tab-btn { justify-content: center; min-width: 0; font-size: 12px; white-space: nowrap; }
  html[data-theme="dark"] .rankings-page .tab-btn svg { width: 14px; height: 14px; }
  html[data-theme="dark"] .rankings-page .matches-filter-group { display: flex; flex-wrap: wrap; width: 100%; }
  html[data-theme="dark"] .rankings-page .filter-btn { min-height: 40px; }
  html[data-theme="dark"] :is(.rk-standings, .rk-scorers) .table { min-width: 0; width: 100%; table-layout: fixed; }
  html[data-theme="dark"] .rankings-page .table :is(td, th) { padding: 10px; }
  /* Position, team, matches played and points. Recent form sits below the team. */
  html[data-theme="dark"] .rk-standings .table :is(th, td):is(:nth-child(3), :nth-child(5), :nth-child(6), :nth-child(7)) { display: none; }
  html[data-theme="dark"] .rk-standings .table .pos-cell { width: 30px; min-width: 0; padding-left: 6px; padding-right: 6px; }
  html[data-theme="dark"] .rk-standings .table .col-name { min-width: 0; }
  html[data-theme="dark"] .rk-standings .table :is(th.stat-cell, td.stat-cell) { min-width: 0; width: 34px; padding-left: 4px; padding-right: 4px; }
  html[data-theme="dark"] .rk-standings .table :is(th, td):last-child { width: 42px; }
  html[data-theme="dark"] .rk-standings .table td.team-cell { white-space: normal; padding-left: 4px; padding-right: 4px; }
  html[data-theme="dark"] .rk-standings .table td.team-cell > .team-emblem { width: 24px; height: 24px; margin-right: 8px; }
  html[data-theme="dark"] .rk-standings .table td.team-cell > div:not(.team-emblem) { width: calc(100% - 36px); vertical-align: middle; }
  html[data-theme="dark"] .rk-standings .table .team-name { font-size: 13px; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
  html[data-theme="dark"] .rk-standings .table .team-category { display: none; }
  .rk-mobile-form { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
  .rk-mobile-form .rk-form { display: inline-flex; align-items: center; justify-content: center; width: 15px !important; height: 15px !important; font-size: 8px !important; border-radius: 3px !important; }
  html[data-theme="dark"] .rk-scorers .table .pos-cell { width: 34px; min-width: 34px; }
  html[data-theme="dark"] .rk-scorers .table :is(th:last-child, td:last-child) { width: 64px; }
  .rk-player { gap: 9px; min-width: 0; }
  .rk-player-copy { min-width: 0; }
  .rk-player-name { font-size: 13px; overflow-wrap: anywhere; }
  .rk-player-team { overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  html[data-theme="dark"] .rankings-page .tab-btn { gap: 4px; font-size: 11px; }
  html[data-theme="dark"] .rk-scorers .table :is(td, th) { padding-left: 7px; padding-right: 7px; }
  html[data-theme="dark"] .rk-scorers .table :is(th:last-child, td:last-child) { width: 48px; }
  .rk-team-mark { width: 24px; height: 24px; }
}
.rk-card-symbol { display: inline-block; width: 9px; height: 13px; border-radius: 2px; vertical-align: middle; }
.rk-card-symbol.is-yellow { background: #e8c25a; }
.rk-card-symbol.is-red { background: #fb8189; }
.rk-card-count { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rk-card-count.is-yellow { color: #e8c25a; }
.rk-card-count.is-red { color: #fb8189; }
.rk-card-count.is-zero { color: #969696; font-weight: 400; }
html[data-theme="dark"] .rk-cards .table { table-layout: fixed; }
html[data-theme="dark"] .rk-cards .table .col-name { min-width: 0; }
html[data-theme="dark"] .rk-cards .table :is(th.stat-cell, td.stat-cell) { width: 70px; min-width: 0; }
html[data-theme="dark"] .rk-cards .table td:last-child { font-size: 15px; color: #ececec; }
.rk-cards .rk-player-copy { min-width: 0; align-items: flex-start; }
.rk-cards .rk-player-name, .rk-cards .rk-player-team { overflow-wrap: anywhere; }
.rk-cards :is(.badge-susp, .susp-cycle) { margin-left: 0; font-size: 9px; line-height: 1.5; white-space: normal; }
@media (max-width: 720px) {
  html[data-theme="dark"] .rk-cards .table { min-width: 0; width: 100%; }
  html[data-theme="dark"] .rk-cards .table :is(td, th) { padding: 10px 6px; }
  html[data-theme="dark"] .rk-cards .table .pos-cell { width: 28px; min-width: 0; }
  html[data-theme="dark"] .rk-cards .table :is(th.stat-cell, td.stat-cell) { width: 30px; min-width: 0; }
  html[data-theme="dark"] .rk-cards .table :is(td, th):last-child { width: 40px; }
  html[data-theme="dark"] .rk-cards .table th { font-size: 10px; }
  .rk-cards .rk-player { gap: 8px; min-width: 0; }
  .rk-cards .rk-team-mark { width: 22px; height: 22px; }
  .rk-cards .rk-player-name { font-size: 12px; line-height: 1.4; }
  .rk-cards .rk-player-team { font-size: 10px; }
  html[data-theme="dark"] .rankings-page .susp-notice { padding: 12px; }
  html[data-theme="dark"] .rankings-page .susp-notice-title { font-size: 11px; line-height: 1.5; }
  html[data-theme="dark"] .rankings-page .susp-notice-list li { align-items: baseline; gap: 4px 8px; font-size: 12px; }
}

/* Neutral black surfaces; blue is reserved for actions and their shadows. */
:root[data-theme="dark"] {
  --field-green: #dedede;
  --field-green-light: #ffffff;
  --field-green-dark: #b8b8b8;
  --chalk-white: #111111;
  --goal-net: #191919;
  --crowd-300: #2c2c2c;
  --crowd-500: #aaaaaa;
  --touchline: #454545;
}
html[data-theme="dark"], html[data-theme="dark"] body { background: #080808; }
html[data-theme="dark"] :is(.btn-primary, .header-admin-btn, .score-stepper-btn.is-add) { background: #2563eb; color: #fff; }
html[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #1d4ed8; box-shadow: 0 5px 18px #2563eb33; }
html[data-theme="dark"] .rankings-page .filter-btn.active { background: #233b60; border-color: #456a9d; color: #dceaff; }
html[data-theme="dark"] :is(.sc-filters button.is-active, .sc-detail-tabs button[aria-selected="true"]) { color: #9cc5ff; border-bottom-color: #5798ff; }
html[data-theme="dark"] .rankings-page .tab-btn.active { color: #9cc5ff; border-bottom-color: #5798ff; }
html[data-theme="dark"] :is(.card, .sc-panel, .table-wrap) { box-shadow: 0 5px 22px #1b4c8a0b; }

.ranking-category-toolbar { display: block; }
.ranking-category-field { width: 100%; max-width: 320px; }
.ranking-category-label { display: block; margin-bottom: 8px; color: #aaa; font-size: 12px; font-weight: 400; }
@media (max-width: 720px) {
  .ranking-category-field { max-width: none; }
}

iesjb-player-leaderboard { display: block; }
.rk-rating-filter { display: flex; flex-direction: column; gap: 7px; max-width: 320px; margin-bottom: 14px; }
.rk-rating-filter label { color: #aaa; font-size: 12px; }
.rk-rating-filter select { min-height: 44px; padding: 9px 12px; border: 1px solid #383838; border-radius: 7px; background: #171717; color: #eee; font-size: 13px; }
.rk-rating-note { max-width: 700px; color: #999; font-size: 12px; line-height: 1.6; margin: 0 0 24px; }
.rk-rating-section { margin-bottom: 28px; }
.rk-rating-section h2 { margin: 0 0 12px; font-size: 17px; font-weight: 700; color: #eee; }
.rk-rating-empty { color: #999; padding: 18px; border: 1px solid #303030; border-radius: 10px; font-size: 13px; }
html[data-theme="dark"] .rankings-page .rk-ratings .table { min-width: 0; table-layout: auto; }
html[data-theme="dark"] .rankings-page .rk-ratings .table th, html[data-theme="dark"] .rankings-page .rk-ratings .table td { display: table-cell; }
.rk-ratings .rk-player-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rk-ratings .rk-player-name { overflow-wrap: anywhere; }
.rk-ratings .stat-cell { white-space: nowrap; text-align: center; }
@media (max-width: 600px) {
  html[data-theme="dark"] .rankings-page .tab-nav { overflow-x: auto; gap: 22px; }
  html[data-theme="dark"] .rankings-page .tab-btn { flex-shrink: 0; white-space: nowrap; }
  html[data-theme="dark"] .rankings-page .rk-ratings .table th, html[data-theme="dark"] .rankings-page .rk-ratings .table td { padding: 12px 8px; }
  html[data-theme="dark"] .rankings-page .rk-ratings .table tr { display: table-row; }
  html[data-theme="dark"] .rankings-page .rk-ratings .table td::before { content: none; }
  .rk-ratings .rk-player-name { font-size: 13px; }
  .rk-ratings .rk-player-team { font-size: 11px; }
}

/* Keep every tab icon visible, including the longer player-ranking label. */
html[data-theme="dark"] .rankings-page .tab-btn svg { flex-shrink: 0; }
@media (max-width: 720px) {
  html[data-theme="dark"] .rankings-page .tab-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; overflow: visible; }
  html[data-theme="dark"] .rankings-page .tab-btn { gap: 7px; white-space: normal; }
}
