/* Fixes found during the hostile 500-state screenshot review. */

/* The live board switcher is now the primary ranking surface. Keep the old
   section as a mount point for coach share controls, but hide its duplicate
   heading/cards/filter UI. */
body #rankingsSection {
  display: flex !important;
  min-height: 0 !important;
  margin: 20px auto 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
body #rankingsSection > div:not(#rankingShareControls),
body #rankingsSection > #lastUpdated,
body .filter-bar,
body #rankingsGrid {
  display: none !important;
}
body #rankingsSection:empty { display: none !important; }
body #rankingShareControls {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin-left: auto !important;
}

/* Keep the useful cross-board table and match history, but separate them clearly from the live board. */
body #statsSection {
  margin-top: 38px !important;
  padding-top: 28px !important;
  border-top: 1px solid var(--tr-line, #dedfdb) !important;
}

/* Coach controls must retain the same selected orange state even when older
   challenge CSS or motion rules are present. Do not fade the selected state in:
   a tab should be unmistakably selected the instant the click lands. */
body #coachLadderConsole .coach-tab,
body #coachLadderConsole .coach-tab[aria-selected="true"] {
  transition: none !important;
  animation: none !important;
}
body #coachLadderConsole .coach-tab[aria-selected="true"] {
  color: #20211f !important;
  background: #ff7657 !important;
  border-color: #ff7657 !important;
  opacity: 1 !important;
}

/* Never depend on the external icon font for the account close affordance. */
.tr-account-icon-close i { display: none !important; }
.tr-account-icon-close::before {
  content: "×" !important;
  display: block !important;
  color: currentColor !important;
  font: 400 24px/1 Arial, sans-serif !important;
}

/* Fixed mobile navigation must not strand controls underneath itself. */
html { scroll-padding-bottom: 92px !important; }
#settingsPanel button,
#settingsPanel input,
#settingsPanel select,
#settingsPanel textarea,
#accountsPanel button,
#accountsPanel input,
#accountsPanel select,
.coach-ladder-console button,
.coach-ladder-console input,
.coach-ladder-console select {
  scroll-margin-bottom: 96px !important;
}

@media (max-width: 700px) {
  body .app-shell { padding-bottom: 128px !important; }
  body main#top { padding-bottom: 24px !important; }
  body #rankingsSection { margin-top: 14px !important; }
  body #rankingShareControls { width: 100% !important; justify-content: flex-start !important; }
  body #statsSection { margin-top: 32px !important; padding-top: 22px !important; }
  body #settingsPanel,
  body #accountsPanel,
  body .coach-ladder-console,
  body .challenge-center { padding-bottom: 116px !important; }

  .tr-account-shell {
    padding: 0 !important;
    overflow: hidden !important;
  }
  .tr-account-sheet {
    box-sizing: border-box !important;
    max-height: calc(100dvh - 6px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    animation: none !important;
    transform: none !important;
  }
}
