/* Shared geometry for the primary AI Lishishu ecosystem navigation. */
html {
  scrollbar-gutter: stable;
}

html::-webkit-scrollbar {
  width: 15px;
}

@media (min-width: 861px) {
  :root {
    --header-height: 76px;
    --topbar-h: 76px;
    --ecosystem-header-height: 76px;
  }

  .site-header,
  #topbar,
  body > header,
  .ecosystem-header[aria-label="AI历史书生态导航"] {
    height: 76px;
    min-height: 76px;
  }

  #topbar,
  body > header:not(.site-header):not(.ecosystem-header) {
    position: relative;
  }

  .site-header > .site-nav[aria-label="AI历史书生态导航"],
  #topbar > .ecosystem-nav[aria-label="AI历史书生态导航"],
  body > header > nav[aria-label="AI历史书生态导航"],
  .ecosystem-header[aria-label="AI历史书生态导航"] > .ecosystem-nav {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: flex;
    width: max-content;
    max-width: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transform: translate(-50%, -50%);
    white-space: nowrap;
  }

  .site-header > .site-nav[aria-label="AI历史书生态导航"] a,
  #topbar > .ecosystem-nav[aria-label="AI历史书生态导航"] a,
  body > header > nav[aria-label="AI历史书生态导航"] a,
  .ecosystem-header[aria-label="AI历史书生态导航"] > .ecosystem-nav a {
    flex: 0 0 auto;
    padding: 9px 11px;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.2;
  }

  .site-header > .account-button,
  .site-header > .header-actions,
  body > header > .account,
  .ecosystem-header[aria-label="AI历史书生态导航"] > .ecosystem-account {
    grid-column: 3;
    justify-self: end;
  }

  #topbar > .top-account-actions {
    margin-left: 0;
  }
}

/* Keep encyclopedia search available without letting it push the nav off-axis. */
@media (min-width: 1101px) and (max-width: 1699px) {
  #topbar > #top-search-box {
    position: relative;
    width: 44px;
    height: 38px;
    max-width: 44px;
    min-width: 44px;
    min-height: 38px;
    margin-left: auto;
    padding-inline: 13px;
    overflow: hidden;
    cursor: text;
    transition: width 180ms ease, max-width 180ms ease, box-shadow 180ms ease;
  }

  #topbar > #top-search-box > input {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    opacity: 0;
    cursor: text;
  }

  #topbar > #top-search-box > .s-btn {
    display: none;
  }

  #topbar > #top-search-box:focus-within {
    z-index: 4;
    width: 280px;
    max-width: 280px;
    padding-inline: 12px;
    overflow: visible;
    background: var(--bg-1, #fff);
    box-shadow: 0 12px 34px rgba(27, 22, 55, 0.14);
  }

  #topbar > #top-search-box:focus-within > input {
    position: static;
    flex: 1 1 auto;
    width: auto;
    opacity: 1;
  }
}

@media (min-width: 861px) and (max-width: 1100px) {
  #topbar > #top-search-box {
    display: none;
  }

  #topbar > .top-account-actions {
    margin-left: auto;
  }

  #topbar #theme-btn,
  #topbar #top-register-btn,
  #topbar #live2dMiniIcon {
    display: none;
  }

  #topbar #top-user-label {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
