/* The account controls reuse Bootstrap's dropdown and the existing menu rows. */
.navbar-wrapper > ul > li.header-account-menu {
  position: relative;
}
.header-account-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 50px;
  margin: 10px auto 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.header-account-toggle:hover,
.header-account-toggle[aria-expanded="true"] {
  background: rgb(160 160 160 / 10%);
}
.header-account-toggle:focus-visible {
  outline: 2px solid var(--link-color, #4652a1);
  outline-offset: 2px;
}
.header-account-menu > .dropdown-menu {
  top: 100%;
  right: 0;
  left: auto;
  width: 280px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 96px - env(safe-area-inset-bottom, 0px));
  margin-top: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.header-account-menu .dropdown-item {
  min-height: 48px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 600;
}
.header-account-menu .dropdown-item > .svg-container,
.header-account-menu .dropdown-item > img {
  flex-shrink: 0;
}
body.night-mode .header-account-toggle:hover,
body.night-mode .header-account-toggle[aria-expanded="true"] {
  background: rgb(234 234 234 / 10%);
}
@media (max-width: 767.98px) {
  /* Reserve five 44px controls while keeping the logo and left menu readable. */
  .main-header.has-account-menu > :is(.container, .container-fluid) > .row {
    flex-wrap: nowrap;
    margin-inline: 0;
  }
  .has-account-menu .header-brand-column {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding-inline: 0;
  }
  .has-account-menu .logo-wrapper {
    padding-left: 44px;
  }
  .has-account-menu .header-tools-column {
    flex: 0 0 220px;
    width: 220px;
    padding-inline: 0;
  }
  .has-account-menu .header-tools-column > .row {
    margin-inline: 0;
  }
  .has-account-menu .header-tools-column > .row > :first-child {
    display: none;
  }
  .has-account-menu .header-tools-column > .row > :last-child {
    padding-inline: 0;
  }
  .has-account-menu .navbar-wrapper > ul {
    justify-content: flex-end;
    margin: 0;
    padding: 0;
  }
  .has-account-menu .navbar-wrapper > ul > li {
    flex: 0 0 44px;
    min-width: 44px;
    margin: 0;
  }
  .has-account-menu .navbar-wrapper > ul > li > a {
    width: 44px;
    padding-inline: 0;
  }
}

/* The category entry reuses the existing list in normal flow, including submenus. */
.settings-categories-entry .settings-categories-header { display: flex !important; }
@media (max-width: 767.98px) {
  .sg-offcanvas.settings-categories-entry .sg-offcanvas-sidebar {
    position: relative !important;
    top: auto;
    left: 0;
    transition: none;
  }
  .sg-offcanvas.settings-categories-entry .sg-offcanvas-mainbar { display: none; }
  /* Dynamic browser chrome must not resize the navigation's safe-area content. */
  html[data-lang="ja_jp"] {
    --mobile-nav-safe-bottom: env(safe-area-max-inset-bottom, env(safe-area-inset-bottom, 0px));
  }
  html[data-lang="ja_jp"] body:has(.footer-bottom-bar:not(.x-hidden)) {
    padding-bottom: calc(86px + var(--mobile-nav-safe-bottom));
  }
  html[data-lang="ja_jp"] body:has(.footer-bottom-bar:not(.x-hidden)) .footer-bottom-bar {
    height: calc(70px + var(--mobile-nav-safe-bottom));
    padding-bottom: var(--mobile-nav-safe-bottom);
    transition: none;
  }
  html[data-lang="ja_jp"] .footer-bottom-bar-links,
  html[data-lang="ja_jp"] .footer-bottom-bar-links > .link,
  html[data-lang="ja_jp"] .footer-bottom-bar-links > .link > a {
    height: 70px;
    min-height: 70px;
    transition: none;
  }
}
/* Search and ranking navigation share the existing icon colors and control geometry. */
.header-search-entry > a:focus-visible {
  outline: 2px solid var(--link-color, #4652a1);
  outline-offset: 2px;
}
@media (max-width: 767.98px) {
  .has-account-menu .logo { font-size: clamp(20px, 6.15vw, 28px); }
  .has-account-menu .logo img { max-width: 100%; height: auto; }
}
@media (min-width: 768px) {
  .has-account-menu .header-tools-column > .row { flex-wrap: nowrap; }
  .has-account-menu .header-tools-column > .row > :first-child {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
  }
  .has-account-menu .header-tools-column > .row > :last-child {
    flex: 0 0 auto;
    min-width: 220px;
    width: auto;
  }
  .has-account-menu .navbar-wrapper > ul > li { flex: 0 0 44px; margin-inline: 0; }
  .has-account-menu .navbar-wrapper > ul > li > a { width: 44px; padding-inline: 0; }
}
.ranking-empty { max-width: 720px; margin-inline: auto; }
.ranking-empty h1 { font-size: 24px; font-weight: 600; line-height: 1.5; }
.ranking-empty p { margin-bottom: 0; font-size: 16px; font-weight: 500; line-height: 1.75; }
