/* MobileMem-Omni leaderboard --------------------------------------------- */

.leaderboard-page {
  --leaderboard-bar-h: 60px;
  min-width: 320px;
  background: #f5f8f5;
}

.leaderboard-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--leaderboard-bar-h);
  border-bottom: 1px solid rgba(217, 225, 220, 0.9);
  background: rgba(251, 251, 248, 0.96);
  backdrop-filter: blur(16px);
}

.leaderboard-topbar-inner {
  width: min(1180px, calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.leaderboard-back {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.leaderboard-back:hover {
  color: var(--green-dark);
}

.leaderboard-back-icon {
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.leaderboard-context {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.leaderboard-topbar .language-toggle {
  justify-self: end;
}

.leaderboard-main {
  overflow: visible;
}

.leaderboard-hero {
  padding: 38px 0 34px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.leaderboard-hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}

.leaderboard-hero h1 {
  max-width: 880px;
  margin-bottom: 0;
  font-size: 54px;
  line-height: 1;
}

.leaderboard-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.benchmark-title-switcher {
  position: relative;
  z-index: 9;
  flex: 0 0 auto;
}

.benchmark-title-switcher summary {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.benchmark-title-switcher summary::-webkit-details-marker {
  display: none;
}

.benchmark-title-switcher summary:hover,
.benchmark-title-switcher[open] summary {
  border-color: rgba(15, 123, 79, 0.4);
  background: #edf5f0;
}

.benchmark-title-switcher summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.benchmark-title-chevron {
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease, margin 160ms ease;
}

.benchmark-title-switcher[open] .benchmark-title-chevron {
  margin-top: 4px;
  transform: rotate(225deg);
}

.benchmark-title-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 218px;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 16px 36px rgba(23, 33, 28, 0.16);
}

.benchmark-title-menu button {
  min-height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.benchmark-title-menu button:hover {
  background: var(--soft);
  color: var(--ink);
}

.benchmark-title-menu button[aria-current="true"] {
  background: #e7f2eb;
  color: var(--green-dark);
  font-weight: 700;
}

.leaderboard-submit-note {
  max-width: 390px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}

.leaderboard-submit-note a {
  display: inline-block;
  color: var(--green-dark);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.leaderboard-submit-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.leaderboard-controls {
  position: sticky;
  top: var(--leaderboard-bar-h);
  z-index: 8;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 248, 0.96);
  backdrop-filter: blur(14px);
}

.leaderboard-control-row {
  min-height: 88px;
  display: grid;
  grid-template-columns:
    minmax(260px, 1.15fr) minmax(230px, 0.95fr) minmax(164px, auto)
    minmax(188px, 0.75fr);
  align-items: center;
  gap: 18px;
}

.leaderboard-page[data-benchmark="textual"] .leaderboard-control-row {
  grid-template-columns: minmax(260px, 1.15fr) minmax(164px, 0.8fr) minmax(188px, 0.85fr);
}

.control-group {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.segmented-control {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.segmented-control button {
  min-width: 0;
  min-height: 36px;
  flex: 1 1 0;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.segmented-control button[aria-pressed="true"] {
  background: var(--green);
  color: var(--white);
}

.leaderboard-resource-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.leaderboard-resource-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.leaderboard-resource-links a:first-child {
  flex: 0.8 1 0;
}

.leaderboard-resource-links a:last-child {
  flex: 1.2 1 0;
}

.leaderboard-resource-links a:hover {
  border-color: rgba(15, 123, 79, 0.38);
  color: var(--green-dark);
}

.rank-control select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}

.leaderboard-results {
  padding: 32px 0 72px;
}

.leaderboard-table-shell {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 32px rgba(23, 33, 28, 0.07);
  overscroll-behavior-x: contain;
}

.leaderboard-table-shell:focus-visible {
  outline: 3px solid rgba(15, 123, 79, 0.38);
  outline-offset: 3px;
}

.leaderboard-table {
  width: 100%;
  min-width: 1160px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 13px 12px;
  border-right: 1px solid #edf0ed;
  border-bottom: 1px solid #e5eae6;
  text-align: right;
  white-space: nowrap;
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
  border-right: 0;
}

.leaderboard-table thead th {
  z-index: 3;
  background: #f1f5f2;
  color: #334139;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.leaderboard-table thead tr:first-child th {
  height: 42px;
  border-bottom-color: #d5ddd7;
  color: var(--muted);
  text-transform: uppercase;
}

.leaderboard-table thead tr:nth-child(2) th {
  min-width: 96px;
  height: 54px;
  white-space: normal;
  line-height: 1.2;
}

.leaderboard-table .rank-column {
  left: 0;
  width: 62px;
  min-width: 62px;
  text-align: center;
}

.leaderboard-table .method-column {
  left: 62px;
  width: 236px;
  min-width: 236px;
  text-align: left;
}

.leaderboard-table tbody .rank-column,
.leaderboard-table tbody .method-column {
  position: sticky;
  z-index: 2;
  background: var(--white);
}

.leaderboard-table thead .rank-column,
.leaderboard-table thead .method-column {
  position: sticky;
  z-index: 5;
}

.leaderboard-table tbody tr:hover td {
  background: #f7faf8;
}

.leaderboard-table tbody tr:hover .rank-column,
.leaderboard-table tbody tr:hover .method-column {
  background: #f7faf8;
}

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

.leaderboard-table td.rank-column {
  color: #7a877f;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.leaderboard-table tbody tr[data-rank="1"] td.rank-column {
  color: var(--green-dark);
  font-size: 16px;
}

.method-cell {
  position: relative;
  display: grid;
  gap: 3px;
  padding-left: 11px;
}

.method-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 3px;
  border-radius: 2px;
  background: var(--green);
}

tr[data-family="multimodal"] .method-cell::before {
  background: var(--coral);
}

.method-cell strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.method-cell small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.leaderboard-table td.score-cell {
  color: #39463f;
  font-weight: 400;
}

.leaderboard-table th.is-ranked,
.leaderboard-table td.is-ranked {
  background: #eaf4ee;
  color: var(--green-dark);
  font-weight: 900;
}

.leaderboard-table tbody tr:hover td.is-ranked {
  background: #dfeee5;
}

.leaderboard-table td.is-best {
  background: var(--green-dark);
  color: var(--white);
}

.leaderboard-table tbody tr:hover td.is-best {
  background: var(--green-dark);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .leaderboard-hero {
    padding-top: 48px;
  }

  .leaderboard-hero h1 {
    font-size: 46px;
  }

  .leaderboard-hero-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .leaderboard-submit-note {
    max-width: none;
    margin: 0;
    text-align: left;
  }

  .leaderboard-controls {
    position: static;
  }

  .leaderboard-control-row {
    min-height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .leaderboard-page[data-benchmark="textual"] .leaderboard-control-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1200px) and (min-width: 981px) {
  .leaderboard-control-row {
    min-height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 18px;
    padding-bottom: 18px;
  }
}

@media (max-width: 700px) {
  .leaderboard-topbar-inner {
    width: calc(100% - 28px);
    gap: 10px;
  }

  .leaderboard-context {
    font-size: 13px;
  }

  .leaderboard-hero {
    padding: 38px 0 30px;
  }

  .leaderboard-hero h1 {
    font-size: 38px;
    line-height: 1.05;
  }

  .leaderboard-title-row {
    gap: 9px;
  }

  .benchmark-title-switcher summary {
    width: 34px;
    height: 34px;
  }

  .benchmark-title-menu {
    left: auto;
    right: 0;
  }

  .leaderboard-control-row {
    grid-template-columns: 1fr;
  }

  .leaderboard-page[data-benchmark="textual"] .leaderboard-control-row {
    grid-template-columns: 1fr;
  }

  .leaderboard-resource-links a {
    flex: 1 1 0;
    justify-content: center;
  }

  .segmented-control button {
    min-width: 0;
    flex: 1 1 auto;
    padding: 0 8px;
    font-size: 11px;
  }

  .leaderboard-results {
    padding: 32px 0 52px;
  }

  .leaderboard-table .method-column {
    width: 200px;
    min-width: 200px;
  }
}
