@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  zoom: 1.2;
  font-family: Arial, Helvetica, sans-serif;
  color: #eef2f7;
  background: #090d13;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --surface: #10161f;
  --surface-raised: #151d28;
  --border: #222c38;
  --muted: #8290a1;
  --faint: #586574;
  --accent: #9bcfff;
  --accent-dark: #152637;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 82% -15%, rgb(74 133 190 / 12%), transparent 36rem),
    #090d13;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(130 144 161 / 14%);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: #f3f5f8;
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.eyebrow,
.section-label h2,
.table-heading {
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0.1em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
}

h2,
p {
  margin-top: 0;
}

.league-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 0;
}

.section-label h2 {
  margin: 0;
  color: #9da8b5;
  font-size: 10px;
  font-weight: 500;
}

.muted {
  color: var(--faint);
  font-size: 11px;
}

.league-tabs,
.view-switch,
.role-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
}

.league-tabs {
  display: grid;
  grid-template-columns: max-content max-content minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.league-group {
  min-width: 0;
}

.league-group-title {
  margin: 0 0 7px;
  color: #78889a;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.league-group-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.league-group-empty {
  color: var(--faint);
  font-size: 10px;
}

.league-tab,
.view-tab,
.role-tab {
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.league-tab {
  min-width: 53px;
  padding: 8px 13px;
  border-color: var(--border);
  background: #0e141c;
  color: #8d99a8;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}

.league-tab:hover,
.role-tab:hover {
  border-color: #395974;
  color: #e6eddf;
}

.league-tab.is-active {
  border-color: #6f9fc9;
  background: var(--accent-dark);
  color: var(--accent);
}

.league-tab.is-empty {
  border-style: dashed;
}

.league-tab.is-empty:not(.is-active) {
  color: #657385;
  background: #0b1118;
}

.dashboard {
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(155deg, rgb(19 27 37 / 98%), rgb(14 20 28 / 98%));
  box-shadow: 0 24px 70px rgb(0 0 0 / 20%);
}

.dashboard-head {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 25px;
  border-bottom: 1px solid var(--border);
}

.dashboard-title .eyebrow {
  margin-bottom: 8px;
}

.dashboard-title h2 {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.view-switch {
  padding: 4px;
  border: 1px solid var(--border);
  background: #0c1118;
}

.view-tab {
  padding: 8px 12px;
  background: transparent;
  color: #84909e;
  font-size: 12px;
}

.view-tab:hover {
  color: #e8edf2;
}

.view-tab.is-active {
  background: #202a35;
  color: #f1f5f8;
}

.load-status {
  padding: 28px 25px;
  margin: 0;
  color: #a7b2be;
  font-size: 13px;
}

.load-status:empty {
  display: none;
}

.load-status.is-error {
  color: #ff9a8d;
}

.load-status button {
  margin-left: 12px;
  padding: 5px 9px;
  border: 1px solid #69443e;
  background: #261b1c;
  color: #ffb1a6;
  cursor: pointer;
  font-size: 11px;
}

.leaderboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 25px;
  border-bottom: 1px solid var(--border);
}

.role-tabs {
  gap: 6px;
}

.role-tab {
  min-width: 58px;
  padding: 7px 10px;
  border-color: #293441;
  background: transparent;
  color: #919daa;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
}

.role-tab.is-active {
  border-color: #3c5a74;
  background: var(--accent-dark);
  color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: #738090;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
  padding-left: 25px;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
  padding-right: 25px;
}

.leaderboard-table td {
  padding: 13px 20px;
  border-bottom: 1px solid rgb(34 44 56 / 68%);
  color: #dce2e9;
  font-size: 12px;
  white-space: nowrap;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.leaderboard-table tbody tr:hover {
  background: rgb(255 255 255 / 2%);
}

.rank-cell {
  width: 70px;
  color: #738090 !important;
  font-family: Arial, Helvetica, sans-serif;
}

.rank-cell.is-top {
  color: var(--accent) !important;
}

.team-name,
.player-name {
  color: #f0f3f6;
  font-weight: 600;
}

.team-league {
  display: block;
  margin-top: 3px;
  color: #7e8da0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
}

.team-expand {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 24px 0 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  white-space: normal;
}

.team-expand:hover .team-name {
  color: var(--accent);
}

.team-expand-icon {
  position: absolute;
  top: 4px;
  right: 2px;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

.roster,
.player-meta {
  display: block;
  margin-top: 4px;
  color: #738090;
  font-size: 10px;
}

.team-details-row:hover {
  background: transparent !important;
}

.team-details-row > td {
  padding: 0 !important;
  background: #0c1219;
  white-space: normal;
}

.team-details {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.team-details-heading {
  padding: 12px 25px 8px;
  color: #718090;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.team-details-scroll {
  overflow-x: auto;
}

.team-details-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.team-details-table th {
  padding: 8px 20px;
  color: #647282;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.team-details-table td {
  padding: 9px 20px;
  border-top: 1px solid rgb(34 44 56 / 55%);
  color: #cbd3dd;
  font-size: 11px;
  white-space: nowrap;
}

.team-details-table th:first-child,
.team-details-table td:first-child {
  padding-left: 25px;
}

.team-details-table th:last-child,
.team-details-table td:last-child {
  padding-right: 25px;
}

.team-details-table tbody tr:last-child td {
  border-bottom: 0;
}

.position-label {
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  text-transform: uppercase;
}

.rating-value {
  color: #e6eddf !important;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px !important;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mobile-metric-label {
  display: none;
}

.dashboard-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 25px;
  border-top: 1px solid var(--border);
  color: #718090;
  font-size: 10px;
}

.page-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 0 32px;
  color: #667382;
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: normal;
}

.page-footer p {
  margin: 0;
}

.empty-state {
  padding: 36px 25px;
  color: #9aa5b2;
  font-size: 13px;
}

.scroll-indicator {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  bottom: 0;
  display: block;
  width: 12px;
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  transition: opacity 180ms ease;
}

.scroll-indicator.is-scrollable {
  opacity: 0.65;
  pointer-events: auto;
  cursor: pointer;
}

.scroll-indicator.is-scrollable:hover,
.scroll-indicator.is-scrollable:focus-visible {
  opacity: 1;
}

.scroll-indicator-thumb {
  position: absolute;
  top: 0;
  left: 4px;
  width: 4px;
  height: 24px;
  background: rgb(155 207 255 / 48%);
  cursor: grab;
  transition:
    width 120ms ease,
    left 120ms ease;
}

.scroll-indicator:hover .scroll-indicator-thumb,
.scroll-indicator:focus-visible .scroll-indicator-thumb {
  left: 3px;
  width: 6px;
}

.scroll-indicator:active .scroll-indicator-thumb {
  cursor: grabbing;
}

@media (max-width: 1040px) {
  .league-section {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .league-tabs {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .league-group:last-child {
    grid-column: 1 / -1;
  }
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .shell {
    width: min(1120px, calc(100% - 30px));
  }

  .topbar {
    height: 68px;
  }

  .league-tabs {
    grid-template-columns: 1fr;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }

  .league-section {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0 16px;
  }

  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .view-switch {
    width: 100%;
  }

  .view-tab {
    flex: 1;
  }

  .leaderboard-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 15px 20px;
  }

  .role-tabs {
    width: 100%;
    gap: 5px;
  }

  .role-tab {
    min-width: 0;
    flex: 1;
    padding: 7px 5px;
  }

  .table-wrap,
  .team-details-scroll {
    overflow: visible;
  }

  .leaderboard-table,
  .leaderboard-table tbody,
  .team-details-table,
  .team-details-table tbody {
    display: block;
  }

  .leaderboard-table thead,
  .team-details-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .leaderboard-table tbody tr {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px 10px;
    padding: 13px 15px;
    border-bottom: 1px solid rgb(34 44 56 / 68%);
  }

  .leaderboard-table tbody tr td,
  .team-details-table tbody tr td {
    width: auto;
    min-width: 0;
    padding: 0 !important;
    border: 0;
    white-space: normal;
  }

  .leaderboard-table tbody tr.team-row td:first-child {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    width: auto;
    padding-top: 2px !important;
  }

  .team-row td:nth-child(2) {
    grid-column: 2 / 4;
    grid-row: 1;
  }

  .team-row td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .team-row td:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
  }

  .leaderboard-table tbody tr.player-row td:first-child {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: start;
    width: auto;
    padding-top: 2px !important;
  }

  .player-row td:nth-child(2) {
    grid-column: 2 / 4;
    grid-row: 1;
  }

  .player-row td:nth-child(3) {
    grid-column: 2 / 4;
    grid-row: 2;
    color: #8d99a8;
    font-size: 10px;
  }

  .player-row td:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  .player-row td:nth-child(5) {
    grid-column: 3;
    grid-row: 3;
  }

  .mobile-metric-label {
    display: block;
    margin-bottom: 3px;
    color: #718090;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 8px;
    font-weight: 400;
    letter-spacing: 0.06em;
    line-height: 1.2;
  }

  .team-details-row {
    display: block !important;
    padding: 0 !important;
    border-bottom: 0 !important;
  }

  .team-details-row > td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .team-details,
  .team-details-scroll {
    width: 100%;
  }

  .team-details-table {
    width: 100%;
    table-layout: fixed;
  }

  .team-details-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    padding: 10px 20px;
    border-top: 1px solid rgb(34 44 56 / 55%);
  }

  .team-details-table tbody tr td:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .team-details-table tbody tr td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .team-details-table tbody tr td:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }

  .team-details-table tbody tr td:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
  }

  .team-details-heading {
    padding-left: 20px;
  }

  .dashboard-footer {
    padding: 13px 20px;
  }

  .page-footer {
    font-size: 9px;
  }

  .scroll-indicator {
    top: 12px;
    right: 3px;
    bottom: 12px;
    width: 2px;
  }

  .scroll-indicator.is-scrollable {
    pointer-events: none;
  }

  .scroll-indicator-thumb {
    left: 0;
    width: 2px;
    height: 36px;
    cursor: default;
    transition: none;
  }

  .scroll-indicator:hover .scroll-indicator-thumb,
  .scroll-indicator:focus-visible .scroll-indicator-thumb {
    left: 0;
    width: 2px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
