:root {
  --app-detail-header-height: 92px;
  --app-detail-control-size: 44px;
  --app-detail-header-gutter: 12px;
  --app-detail-header-surface: rgba(250, 251, 249, 0.98);
  --app-detail-header-line: rgba(21, 61, 63, 0.1);
  --app-detail-header-ink: #161d1d;
}

.app-detail-header {
  position: sticky;
  top: 0;
  z-index: 14;
  display: grid;
  grid-template-columns: var(--app-detail-control-size) minmax(0, 1fr) var(--app-detail-control-size);
  height: var(--app-detail-header-height);
  min-height: var(--app-detail-header-height);
  align-items: end;
  padding: 48px var(--app-detail-header-gutter) 0;
  border-bottom: 1px solid var(--app-detail-header-line);
  background: var(--app-detail-header-surface);
  color: var(--app-detail-header-ink);
  font-family: "PingFang SC", "Alibaba PuHuiTi", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
  backdrop-filter: blur(12px);
}

.app-detail-header > .app-detail-back,
.app-detail-header > .app-detail-action,
.app-detail-header > .app-detail-spacer,
.app-detail-header > .app-detail-title,
.app-detail-header > .app-detail-title-wrap {
  align-self: end;
  height: var(--app-detail-control-size);
}

.app-detail-header > .app-detail-back,
.app-detail-header > .app-detail-action {
  position: static;
  display: grid;
  width: var(--app-detail-control-size);
  min-width: var(--app-detail-control-size);
  height: var(--app-detail-control-size);
  min-height: var(--app-detail-control-size);
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  pointer-events: auto;
}

.app-detail-header > .app-detail-back img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: invert(1);
  transform: none;
}

.app-detail-header > .app-detail-action img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: invert(1);
}

.app-detail-header > .app-detail-title,
.app-detail-title-wrap {
  display: grid;
  min-width: 0;
  margin: 0;
  place-items: center;
  text-align: center;
}

.app-detail-header > .app-detail-title,
.app-detail-header > :is(h1, strong).app-detail-title,
.app-detail-header > .app-detail-title-wrap .app-detail-title {
  overflow: hidden;
  margin: 0;
  color: var(--app-detail-header-ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-detail-header > .app-detail-spacer {
  display: block;
  width: var(--app-detail-control-size);
}

.app-detail-header button:focus-visible {
  outline: 2px solid #2c686a;
  outline-offset: -4px;
}

.app-detail-header button:active {
  background: rgba(21, 61, 63, 0.06);
}

.wang-topbar.app-detail-header,
.wang-article-topbar.app-detail-header,
.market-subpage-header.app-detail-header,
.market-region-header.market-subpage-header.app-detail-header,
.order-confirm-header.app-detail-header,
.product-detail-topbar.app-detail-header,
.profile-detail-header.app-detail-header {
  grid-template-columns: var(--app-detail-control-size) minmax(0, 1fr) var(--app-detail-control-size);
  height: var(--app-detail-header-height);
  min-height: var(--app-detail-header-height);
  align-items: end;
  padding: 48px var(--app-detail-header-gutter) 0;
  border-bottom: 1px solid var(--app-detail-header-line);
  background: var(--app-detail-header-surface);
}

.app-detail-header.app-detail-header--seamless {
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  transition:
    background-color 160ms ease-out,
    box-shadow 160ms ease-out;
}

.app-detail-header.app-detail-header--seamless.is-scrolled {
  background: rgba(245, 244, 239, 0.94);
  box-shadow: inset 0 -1px rgba(21, 61, 63, 0.06);
  backdrop-filter: blur(10px) saturate(0.92);
}

.product-detail-topbar.app-detail-header {
  right: auto;
  left: auto;
  width: 100%;
  height: auto;
  pointer-events: auto;
}

.market-cart-heading.app-detail-header {
  display: grid;
  flex-basis: auto;
}

.market-cart-heading .app-detail-title-wrap > p {
  display: none;
}

.market-search-page-header {
  display: block;
  min-height: 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--app-detail-header-line);
  background: var(--app-detail-header-surface);
}

.market-search-page-header .market-search-nav {
  position: relative;
  min-height: var(--app-detail-header-height);
  padding: 48px var(--app-detail-header-gutter) 0;
  border-bottom: 0;
  backdrop-filter: none;
}

.market-search-page-header .market-search-page-form {
  width: auto;
  height: 40px;
  margin: 8px 12px 0;
}

html.view-h5 .app-detail-header,
html.view-h5 .wang-topbar.app-detail-header,
html.view-h5 .wang-article-topbar.app-detail-header,
html.view-h5 .market-subpage-header.app-detail-header,
html.view-h5 .market-region-header.market-subpage-header.app-detail-header,
html.view-h5 .order-confirm-header.app-detail-header,
html.view-h5 .product-detail-topbar.app-detail-header,
html.view-h5 .profile-detail-header.app-detail-header,
html.view-h5 .market-search-page-header .market-search-nav {
  min-height: calc(var(--app-detail-control-size) + env(safe-area-inset-top, 0px));
  height: calc(var(--app-detail-control-size) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

html.view-h5 .market-cart-heading.app-detail-header {
  flex-basis: calc(var(--app-detail-control-size) + env(safe-area-inset-top, 0px));
}

@media (prefers-reduced-motion: reduce) {
  .app-detail-header button {
    transition: none;
  }
}
