.rank-page .rank-intro,
.rank-toolbar,
.rank-footer,
#rank-pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.rank-page .page-head { padding-bottom: 20px; }
.rank-intro h1 { margin: 0; }
.rank-section { padding-top: 14px; }
.rank-toolbar { margin-bottom: 18px; }
.rank-toolbar h2 { margin: 0; font-size: 22px; }
#rank-subtitle { margin: 5px 0 0; font-size: 13px; }
.rank-switch, .rank-period { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); }
.rank-switch button, .rank-period button, #rank-table th button {
  background: transparent; color: var(--muted); border: none; padding: 7px 13px;
  font: inherit; font-weight: 650; font-size: 13px; border-radius: 7px; cursor: pointer;
}
.rank-switch button { min-width: 76px; }
.rank-switch button[aria-pressed=true] { background: var(--ltc); color: white; }
.rank-period button[aria-pressed=true] { background: var(--surface-2); color: var(--text); }
.rank-period button:hover, .rank-switch button:hover, #rank-table th button:hover { color: var(--text); }
.rank-panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
#rank-table { width: 100%; min-width: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#rank-table th, #rank-table td { padding: 14px 10px; text-align: right; }
#rank-table td { font-family: var(--font-numbers); font-size: 14px; }
#rank-table thead { background: var(--surface-2); }
#rank-table thead th { font-size: 12px; white-space: normal; }
#rank-table th button { padding: 4px 0; font-size: inherit; text-align: inherit; text-transform: inherit; letter-spacing: inherit; line-height: 1.3; }
#rank-table th[aria-sort=descending] button { color: var(--gold-hi); }
#rank-table th[aria-sort=descending] button::after { content: ' ↓'; }
#rank-table .rank-position { text-align: center; width: 65px; color: var(--muted); }
#rank-table .rank-name { text-align: left; overflow-wrap: anywhere; max-width: 22em; }
#rank-table tbody .rank-name { font: inherit; font-weight: 650; color: var(--text); }
#rank-table tbody .rank-anon { font-weight: 450; color: var(--muted); }
#rank-table .rank-first { color: var(--gold-hi); font-weight: 700; }
#rank-table tr > :last-child { padding-right: 18px; }
#rank-table tbody tr:last-child > * { border-bottom: none; }
.rank-footer { color: var(--muted); font-size: 12px; margin: 12px 0 22px; min-height: 20px; }
#rank-pages { gap: 10px; }
.rank-notice { padding: 18px 20px; margin: 0; color: var(--muted); }
.rank-retry { margin: 0 0 18px 20px; }
.rank-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 8px 0 18px; font-size: 13px; }
.rank-help dt { font-weight: 650; color: var(--text); }
.rank-help dd { margin: 0; color: var(--muted); }
.rank-mobile-sort, #rank-table td .rank-mobile-label { display: none; }
.rank-privacy-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 650; }
.rank-privacy-toggle input { appearance: none; display: inline-block; width: 40px; min-width: 40px; height: 24px; border: 1px solid var(--line-2); border-radius: 15px; margin: 0; background: var(--bg-2); padding: 3px; cursor: pointer; }
.rank-privacy-toggle input::before { content: ''; display: block; height: 16px; width: 16px; border-radius: 50%; background: var(--muted); }
.rank-privacy-toggle input:checked { background: var(--ltc); border-color: var(--ltc); }
.rank-privacy-toggle input:checked::before { background: white; transform: translateX(15px); }
.rank-privacy-toggle input:disabled { opacity: .6; }
.rank-privacy .hint { margin: 8px 0 14px; }
.rank-privacy #anon-status:empty { display: none; }
.rank-page [hidden], .rank-privacy [hidden], #rank-pages[hidden] { display: none !important; }
@media (max-width: 720px) {
  .rank-intro h1 { font-size: 32px; }
  .rank-toolbar { align-items: flex-start; gap: 12px; }
  .rank-toolbar h2 { font-size: 20px; }
  .rank-mobile-sort { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
  .rank-mobile-sort select { width: auto; min-height: 36px; }
  #rank-table, #rank-table tbody { display: block; }
  #rank-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #rank-table thead button { visibility: hidden; }
  #rank-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px 16px; gap: 6px 16px; position: relative; border-bottom: 1px solid var(--line); }
  #rank-table tbody tr:last-child { border-bottom: none; }
  #rank-table tbody tr > * { background: transparent; border: none; padding: 0; white-space: normal; text-align: left; }
  #rank-table tbody .rank-position { position: absolute; top: 12px; right: 16px; width: auto; }
  #rank-table .rank-name { grid-column: 1 / -1; padding-right: 55px; margin-bottom: 3px; }
  #rank-table td .rank-mobile-label { display: block; font: 12px/1.5 system-ui,sans-serif; color: var(--muted); }
  .rank-help dl { display: block; }
  .rank-help dd { margin-bottom: 9px; }
}
@media(max-width: 420px) {
  .rank-page .rank-intro { gap: 8px; }
  .rank-switch button { min-width: 52px; padding: 6px 8px; }
}

.rank-best-basis { display: block; white-space: normal; color: var(--muted); font: 11px/1.4 system-ui, sans-serif; }
