/* Player details use a solid themed surface, including previously built clients. */
[role="dialog"][data-player-detail],
[role="dialog"]:has([data-simulator-player-accounts]) {
  background: var(--player-detail-surface, #fff) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Paint the H5 root padding with the management page's charcoal surface. */
body.h5-shell #root:has([data-tournament-management]),
body.h5-shell #root:has([data-competition-admin-workspace]) {
  background-color: #3b3d43;
}

/* Keep the admin toolbar close to the competition title on desktop and mobile. */
#root header:has(+ main [data-competition-admin-workspace]) {
  padding-bottom: 8px;
}
#root header:has(+ main [data-competition-admin-workspace]) > div > .mb-4 {
  margin-bottom: 0;
}

/* Desktop workspace: the browser allocates all space remaining below the toolbar. */
@media (min-width: 1024px) {
  #root div:has(> header + main [data-competition-admin-workspace]) {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
  }
  #root header:has(+ main [data-competition-admin-workspace]) {
    min-height: 64px;
    padding-bottom: 16px;
  }
  #root header + main:has([data-competition-admin-workspace]),
  #root header + main > [data-competition-admin-workspace] {
    display: contents;
  }
  #root header + main > [data-competition-admin-workspace] > div:first-child {
    position: absolute;
    z-index: 20;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 440px);
    height: 40px;
    margin: 0;
    padding-right: 44px;
    gap: 12px;
  }
  #root header + main > [data-competition-admin-workspace] > div:first-child > a {
    width: 32px;
    height: 32px;
  }
  #root header + main > [data-competition-admin-workspace] h1 {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  #root header + main > [data-competition-admin-workspace] > .grid {
    position: relative;
    z-index: 10;
    height: auto;
    min-height: 0;
    min-width: 0;
    padding: 0 16px 16px;
    overflow: hidden;
    align-items: stretch;
  }
  #root header + main [data-competition-admin-workspace] > .grid > aside,
  #root header + main [data-competition-admin-content] {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #root header + main [data-competition-admin-workspace] > .grid > aside > nav {
    min-height: 100%;
  }
}
