/* Account controls share predictable space with the page title and notification bell. */
body:not(.auth-page-body) .user-panel {
  right: calc(var(--bbs-content-gutter, 24px) + 58px);
  max-width: calc(100vw - var(--bbs-shell-width, 240px) - 220px);
}

/* Keep the editor's preview action beside, rather than under, the notification bell. */
body.course-map-editor-page .course-map-studio-bar {
  left: max(10px, env(safe-area-inset-left, 0px));
  right: calc(72px + env(safe-area-inset-right, 0px));
  width: auto;
  max-width: 840px;
  margin-inline: auto;
  transform: none;
}

body:not(.auth-page-body) .user-copy {
  min-width: 0;
  max-width: 160px;
}

body:not(.auth-page-body) .user-name {
  display: block;
  max-width: 100%;
  min-width: 0;
  line-height: 1.5;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
}

body:not(.auth-page-body) .user-summary {
  min-width: 0;
  flex-shrink: 1;
}

.registration-note {
  margin: 0 0 20px;
  color: var(--ui-muted, #52666b);
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (min-width: 901px) and (max-width: 1180px) {
  body:not(.auth-page-body) .user-economy-stack .user-status {
    display: grid !important;
  }

  body:not(.auth-page-body) .user-copy {
    max-width: 120px;
  }
}

@media (max-width: 900px) {
  body:not(.auth-page-body) .user-panel {
    right: calc(66px + env(safe-area-inset-right, 0px));
    width: 44px;
    max-width: 44px;
  }

  body:not(.auth-page-body) .user-copy {
    display: none !important;
  }

  body:not(.auth-page-body) .user-name {
    width: 100%;
    text-align: left;
    font-size: 0.88rem;
  }

  body:not(.auth-page-body) .user-economy-stack {
    top: calc(64px + env(safe-area-inset-top, 0px));
    right: calc(14px + env(safe-area-inset-right, 0px));
  }

  body:not(.auth-page-body) .user-actions .mobile-theme-toggle {
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: calc(118px + env(safe-area-inset-right, 0px));
  }

  body:not(.auth-page-body) .main-content::before {
    box-sizing: border-box;
    right: calc(14px + env(safe-area-inset-right, 0px));
    height: 166px;
    padding-right: 154px;
    padding-bottom: 102px;
    font-size: clamp(1.3rem, 5.5vw, 1.7rem);
  }

  body:not(.auth-page-body) .main-content,
  body.home-page .landing-main {
    padding-top: calc(184px + env(safe-area-inset-top, 0px)) !important;
    min-width: 0;
  }

  body:not(.auth-page-body) .main-content > *,
  body:not(.auth-page-body) .settings-shell > *,
  body:not(.auth-page-body) .admin-directory-shell > * {
    min-width: 0;
    max-width: 100%;
  }

  body.adminusers-page .admin-page-header,
  body.adminusers-page .admin-header-actions {
    flex-wrap: wrap;
  }

  body.adminusers-page .admin-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  body.auth-page-body .auth-grid-row,
  body.auth-page-body .auth-field {
    min-width: 0;
  }

  body.auth-page-body .auth-inline input {
    min-width: 0;
    width: 100%;
  }

  body.auth-page-body .auth-inline-button {
    flex-shrink: 0;
  }
}

/* Compact mobile account actions and balances into one row. */
@media (max-width: 900px) {
  body:not(.auth-page-body) .user-economy-stack {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0;
  }
  body:not(.auth-page-body) .user-economy-stack :is(.economy-shortcuts, .user-status) {
    display: contents !important;
  }
  body:not(.auth-page-body) .user-economy-stack :is(.economy-shortcut, .currency) {
    width: auto;
    min-width: max-content;
    min-height: 32px;
    height: 32px;
    padding: 4px 6px;
    gap: 3px;
    flex: 1 0 auto;
    font-size: 11px;
    border-radius: 6px !important;
  }
  body:not(.auth-page-body) .user-economy-stack .currency {
    border: 0 !important;
    background: transparent !important;
  }
  body:not(.auth-page-body) .user-economy-stack :is(.economy-shortcut-icon, .currency-icon) {
    width: 14px;
    height: 14px;
  }
  body:not(.auth-page-body) .main-content::before {
    height: 112px;
    padding-bottom: 48px;
  }
  body:not(.auth-page-body) .main-content,
  body.home-page .landing-main {
    padding-top: calc(128px + env(safe-area-inset-top, 0px)) !important;
  }
}
/* Keep all three balances initially visible on narrow phones. The shortcut
   labels stay available to assistive technology; exceptionally long balances
   can still use the existing horizontal scroll instead of being truncated. */
@media (max-width: 374px) {
  body:not(.auth-page-body) .user-economy-stack {
    gap: 4px;
  }
  body:not(.auth-page-body) .user-economy-stack .economy-shortcut {
    flex: 0 0 44px;
    min-width: 44px;
  }
  body:not(.auth-page-body) .user-economy-stack .economy-shortcut span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  body:not(.auth-page-body) .user-economy-stack .currency {
    padding-inline: 3px;
  }
}
.max-file-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.max-file-tools small {
  flex: 1;
  min-width: 180px;
}
.max-file-tools ul {
  flex-basis: 100%;
  margin: 0;
  padding-left: 20px;
  overflow-wrap: anywhere;
}
