/* Native shell layer: one viewport, transparent top chrome, no accidental page sliders. */
html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

body:not(.social-authenticated) .topbar,
body.social-authenticated .topbar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-theme="light"] body:not(.social-authenticated) .topbar,
html[data-theme="light"] body.social-authenticated .topbar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body:not(.social-authenticated) .app-shell {
  width: 100vw !important;
  max-width: none !important;
  margin-inline: 0 !important;
}

html[data-theme="light"] body:not(.social-authenticated) .app-shell {
  width: 100vw !important;
  max-width: none !important;
  margin-inline: 0 !important;
}

body:not(.social-authenticated) .app-shell {
  height: 100svh !important;
  min-height: 100svh !important;
  overflow: hidden !important;
}

body:not(.social-authenticated) .auth-screen {
  height: calc(100svh - 72px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Keep sign-in and signup in one stable card. Longer forms scroll inside it
   instead of pushing the whole desktop page below the viewport. */
body:not(.social-authenticated) .auth-card {
  height: min(760px, calc(100svh - 180px)) !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

body:not(.social-authenticated) .auth-card-head,
body:not(.social-authenticated) .auth-tabs,
body:not(.social-authenticated) .auth-provider-actions,
body:not(.social-authenticated) .auth-security {
  flex: 0 0 auto !important;
}

body:not(.social-authenticated) .auth-card .auth-form:not([hidden]) {
  min-height: 0 !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  align-content: start !important;
  padding-right: 4px !important;
  padding-bottom: 4px !important;
  overscroll-behavior: contain !important;
  scrollbar-width: thin;
}

body.social-authenticated {
  width: 100%;
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
}

body.social-authenticated .app-shell,
body.social-authenticated .social-shell,
body.social-authenticated .social-main,
body.social-authenticated .social-view,
body.social-authenticated .social-dashboard-grid,
body.social-authenticated .social-card,
body.social-authenticated .social-side-stack {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.social-authenticated .app-shell {
  width: 100% !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Transparent top navigation: content and ambient background continue behind it. */
body.social-authenticated .topbar {
  position: fixed !important;
  z-index: 140 !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 72px !important;
  min-height: 72px !important;
  margin: 0 !important;
  padding: max(12px, env(safe-area-inset-top)) 24px 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.social-authenticated .social-shell {
  display: grid !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  padding: 82px 24px 24px !important;
  overflow: hidden !important;
}

body.social-authenticated #social-shell.social-shell {
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  padding: 82px 24px 24px !important;
  overflow: hidden !important;
}

body.social-authenticated .social-rail {
  min-width: 0 !important;
  max-width: 100% !important;
  height: calc(100dvh - 106px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body.social-authenticated .social-main {
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

body.social-authenticated .social-view {
  width: 100% !important;
  height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

body.social-authenticated .social-main-header {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.social-authenticated .social-dashboard-grid,
body.social-authenticated .social-dashboard-grid.direct-chat-open {
  width: 100% !important;
  max-width: 100% !important;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px) !important;
  overflow: visible !important;
}

body.social-authenticated .social-dashboard-grid > *,
body.social-authenticated .social-side-stack > *,
body.social-authenticated .direct-chat-card:not([hidden]) {
  min-width: 0 !important;
  max-width: 100% !important;
}

body.social-authenticated img,
body.social-authenticated video,
body.social-authenticated iframe,
body.social-authenticated canvas {
  max-width: 100%;
}

body.social-authenticated input,
body.social-authenticated select,
body.social-authenticated textarea,
body.social-authenticated button {
  max-width: 100%;
}

@media (min-width: 681px) {
  body.social-authenticated #social-shell.social-shell {
    display: grid !important;
    grid-template-columns: 104px minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  body.social-authenticated #social-shell.social-shell > .social-main {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  body.social-authenticated #social-shell.social-shell .social-rail {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: 86px !important;
    height: calc(100dvh - 106px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    transform: none !important;
    overflow: hidden !important;
  }

  body.social-authenticated #social-shell.social-shell .social-nav {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    align-content: center !important;
    transform: none !important;
  }

  body.social-authenticated #social-shell.social-shell .social-nav-button {
    width: 100% !important;
    min-width: 0 !important;
    height: 56px !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 6px 4px !important;
    transform: none !important;
  }
}

@media (max-width: 980px) {
  body.social-authenticated .social-shell {
    padding-inline: 16px !important;
  }

  body.social-authenticated .social-dashboard-grid,
  body.social-authenticated .social-dashboard-grid.direct-chat-open {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.social-authenticated .social-side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 680px) {
  /* On phones, keep the auth surface focused on sign-in/sign-up only. */
  body:not(.social-authenticated) .auth-hero,
  html[data-theme="light"] body:not(.social-authenticated) .auth-hero {
    display: none !important;
  }

  body:not(.social-authenticated) .auth-screen {
    height: calc(100svh - 64px) !important;
    min-height: calc(100svh - 64px) !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 18px 16px max(28px, env(safe-area-inset-bottom)) !important;
  }

  body:not(.social-authenticated) .auth-card {
    width: 100% !important;
    max-width: 480px !important;
    margin: 0 auto !important;
    height: calc(100svh - 82px - max(28px, env(safe-area-inset-bottom))) !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  body:not(.social-authenticated) .auth-card-head,
  body:not(.social-authenticated) .auth-tabs,
  body:not(.social-authenticated) .auth-provider-actions,
  body:not(.social-authenticated) .auth-security {
    flex: 0 0 auto !important;
  }

  body:not(.social-authenticated) .auth-card .auth-form:not([hidden]) {
    min-height: 0 !important;
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    align-content: start !important;
    padding-right: 4px !important;
    padding-bottom: 4px !important;
    overscroll-behavior: contain !important;
  }

  body.social-authenticated .topbar {
    height: 60px !important;
    min-height: 60px !important;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px !important;
  }

  body.social-authenticated .topbar .wordmark {
    font-size: 19px !important;
  }

  body.social-authenticated .social-shell {
    display: block !important;
    height: 100dvh !important;
    padding: 60px 0 calc(76px + env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  body.social-authenticated .social-main {
    height: 100% !important;
    min-height: 0 !important;
  }

  /* These selectors outrank older #social-shell mobile patches. */
  body.social-authenticated #social-shell.social-shell {
    display: block !important;
    width: 100% !important;
    height: 100dvh !important;
    min-height: 0 !important;
    padding: 60px 0 calc(76px + env(safe-area-inset-bottom)) !important;
    overflow: hidden !important;
  }

  body.social-authenticated #social-shell.social-shell > .social-main {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  body.social-authenticated .social-view {
    height: 100% !important;
    min-height: 0 !important;
    padding: 12px 12px 20px !important;
  }

  body.social-authenticated .social-view[data-social-panel="chats"] {
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 0 20px !important;
  }

  body.social-authenticated .social-dashboard-grid,
  body.social-authenticated .social-dashboard-grid.direct-chat-open {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  body.social-authenticated .social-contacts-card,
  body.social-authenticated .social-side-stack,
  body.social-authenticated .direct-chat-card:not([hidden]) {
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 0 12px !important;
  }

  body.social-authenticated .social-side-stack {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 0 12px 12px !important;
  }

  body.social-authenticated .social-rail {
    position: fixed !important;
    z-index: 150 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
    height: calc(68px + env(safe-area-inset-bottom)) !important;
    min-height: 68px !important;
    padding: 6px 8px env(safe-area-inset-bottom) !important;
    border: 0 !important;
    border-top: 1px solid rgba(148, 180, 232, .15) !important;
    border-radius: 0 !important;
    background: rgba(8, 15, 29, .76) !important;
    box-shadow: 0 -14px 34px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .08) !important;
    backdrop-filter: blur(24px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(140%) !important;
    overflow: hidden !important;
  }

  body.social-authenticated .social-rail-security,
  body.social-authenticated .social-rail-brand {
    display: none !important;
  }

  body.social-authenticated .social-nav {
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 2px !important;
    margin: 0 !important;
  }

  body.social-authenticated #social-shell.social-shell .social-nav {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 2px !important;
    transform: none !important;
  }

  body.social-authenticated .social-nav-button {
    display: grid !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    align-content: center !important;
    justify-items: center !important;
    gap: 3px !important;
    padding: 4px 2px !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: var(--ui-muted, #8e9bad) !important;
  }

  body.social-authenticated #social-shell.social-shell .social-nav-button {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 4px 2px !important;
    transform: none !important;
  }

  body.social-authenticated .social-nav-button.is-active {
    background: color-mix(in srgb, var(--ui-accent, #7c6cf2) 18%, transparent) !important;
    color: var(--ui-text, #f4f7fb) !important;
    box-shadow: none !important;
  }

  body.social-authenticated .social-nav-button .nav-icon {
    width: 26px !important;
    height: 27px !important;
  }

  body.social-authenticated .social-nav-button b {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    font-size: 9px !important;
    line-height: 1.1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  body.social-authenticated .social-card-head,
  body.social-authenticated .social-main-header,
  body.social-authenticated .halo-guild-toolbar,
  body.social-authenticated .halo-games-a-header,
  body.social-authenticated .halo-games-a-chat > header {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.social-authenticated .social-card-head {
    gap: 10px !important;
  }

  body.social-authenticated .social-card-head > div:first-child {
    min-width: 0 !important;
  }

  body.social-authenticated .social-card-head h2,
  body.social-authenticated .social-card-head p,
  body.social-authenticated .social-profile-identity,
  body.social-authenticated .halo-guild-toolbar > div {
    overflow-wrap: anywhere !important;
  }
}

/* Keep the security check inside the dark visual system. */
html[data-theme="dark"] body:not(.social-authenticated) .halo-captcha {
  border-color: rgba(103, 175, 235, .2) !important;
  background: rgba(7, 17, 31, .76) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .06), 0 8px 20px rgba(0, 0, 0, .16) !important;
}

html[data-theme="dark"] body:not(.social-authenticated) .halo-captcha-question {
  color: #c9e5ff !important;
}

html[data-theme="dark"] body:not(.social-authenticated) .halo-captcha input {
  border-color: rgba(103, 175, 235, .24) !important;
  background: rgba(15, 30, 52, .9) !important;
  color: #eff7ff !important;
}

html[data-theme="dark"] body:not(.social-authenticated) .halo-captcha input::placeholder {
  color: #91a8c2 !important;
}

html[data-theme="light"] body:not(.social-authenticated) .auth-passkey-button {
  color: #101c2d !important;
}

@media (max-width: 380px) {
  body.social-authenticated .topbar {
    padding-inline: 8px !important;
  }

  body.social-authenticated .social-view {
    padding-inline: 8px !important;
  }

  body.social-authenticated .social-nav-button b {
    font-size: 8px !important;
  }
}
