/*
 * Shared PC shell for refactored public pages.
 * The legacy header/footer templates and their ThinkPHP contracts stay intact.
 */

body.ui-v2 > header {
  z-index: 120;
  min-width: 0;
  padding: 0 var(--ui-page-gutter);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 76% 34%, rgba(56, 214, 232, 0.16), transparent 30%),
    linear-gradient(112deg, #031126 0%, #07428f 58%, #0878cf 100%);
  box-shadow: 0 10px 32px rgba(0, 22, 59, 0.14);
  transition: background var(--ui-duration-normal) var(--ui-ease-standard),
    box-shadow var(--ui-duration-normal) var(--ui-ease-standard),
    backdrop-filter var(--ui-duration-normal) var(--ui-ease-standard);
}

/* Keep every non-home public shell available while its page scrolls. */
body.ui-v2:not(.page-home-v2) > header {
  position: sticky;
  top: 0;
}

body.page-home-v2 > header {
  background: transparent;
  box-shadow: none;
}

body.page-product-purchase-v2 > header {
  background:
    radial-gradient(circle at 75% 35%, rgba(56, 214, 232, 0.18), transparent 28%),
    linear-gradient(135deg, #031126, #0a3f9d 58%, #087ee1);
  box-shadow: 0 12px 40px rgba(0, 22, 59, 0.14);
}

body.ui-v2 > header.is-scrolled {
  top: 0 !important;
  background: rgba(3, 17, 38, 0.92);
  box-shadow: 0 10px 32px rgba(0, 12, 36, 0.2);
  backdrop-filter: blur(18px) saturate(145%);
}

body.page-home-v2 > header.is-scrolled {
  position: fixed;
}

body.ui-v2 > header #header {
  width: min(100%, var(--ui-shell-width)) !important;
  max-width: var(--ui-shell-width) !important;
  min-width: 0 !important;
  min-height: 72px;
  margin-inline: auto !important;
  padding-inline: 0 !important;
  background: transparent !important;
  box-sizing: border-box;
}

body.ui-v2 > header #header .header-outer {
  width: 100% !important;
  max-width: none !important;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.ui-v2 > header #header .head-left,
body.ui-v2 > header #header .head-right {
  float: none;
  display: flex;
  align-items: center;
}

body.ui-v2 > header #header .head-left {
  min-width: 0;
  flex: 1;
}

body.ui-v2 > header #header .head-logo {
  width: 132px;
  height: 46px;
  margin-right: clamp(18px, 2vw, 36px);
  flex: 0 0 132px;
}

body.ui-v2 > header #header .head-left .head-logo a {
  width: 100%;
  height: 100%;
  display: block;
  transform: none;
}

body.ui-v2 > header #header .head-nav {
  float: none;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.ui-v2 > header #header .head-nav .head-nav-item {
  float: none;
  position: relative;
}

body.ui-v2 > header #header .head-nav .head-nav-item > a {
  height: 72px;
  padding: 0 clamp(8px, 0.7vw, 13px);
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--ui-duration-fast), background var(--ui-duration-fast);
}

body.ui-v2 > header #header .head-nav .head-nav-item > a:hover,
body.ui-v2 > header #header .head-nav .head-nav-item > a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

body.ui-v2 > header #header .head-nav .head-drop {
  min-width: 160px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ui-radius-md);
  background: rgba(3, 17, 38, 0.97);
  box-shadow: var(--ui-shadow-md);
  backdrop-filter: blur(18px);
}

body.ui-v2 > header #header .head-nav .head-drop a {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}

body.ui-v2 > header #header .head-right {
  flex: 0 0 auto;
  white-space: nowrap;
}

body.ui-v2 > header #header .head-right .filing a,
body.ui-v2 > header #header .head-right .filing a span,
body.ui-v2 > header #header .head-right .filing a span em,
body.ui-v2 > header #header .head-right .user a {
  color: rgba(255, 255, 255, 0.88);
}

body.ui-v2 > header #header .register-btn-wrap .register-btn {
  min-width: 88px;
  height: 38px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

body.ui-v2 .ui-nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

body.ui-v2 .ui-nav-toggle span,
body.ui-v2 .ui-nav-toggle::before,
body.ui-v2 .ui-nav-toggle::after {
  content: "";
  width: 18px;
  height: 2px;
  margin: 4px auto;
  display: block;
  border-radius: 2px;
  background: currentColor;
  transition: transform var(--ui-duration-fast), opacity var(--ui-duration-fast);
}

/* Shared public PC footer. Page styles must not redefine footer geometry. */
body.ui-v2 .site-footer,
body.ui-v2 .site-footer #footer,
body.ui-v2 .site-footer #footer .footer-wrap {
  min-width: 0 !important;
  max-width: 100%;
}

body.ui-v2 .site-footer #footer {
  background: var(--ui-color-navy-950);
}

body.ui-v2 .site-footer #footer .footer-wrap {
  width: 100%;
  padding: clamp(48px, 4.4vw, 84px) var(--ui-page-gutter) 0;
}

body.ui-v2 .site-footer #footer .footer-wrap > div {
  width: min(100%, var(--ui-shell-width));
  max-width: var(--ui-shell-width);
  margin-inline: auto;
}

body.ui-v2 .site-footer #footer .footer-top {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.ui-v2 .site-footer #footer .footer-top ul {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
}

body.ui-v2 .site-footer #footer .footer-top ul li {
  width: auto !important;
  min-width: 0;
}

body.ui-v2 .site-footer #footer .footer-nav {
  transition: transform var(--ui-duration-fast);
}

body.ui-v2 .site-footer #footer .footer-nav:hover {
  transform: translateY(-3px);
}

body.ui-v2 .site-footer #footer .footer-bottom {
  border-top-color: rgba(255, 255, 255, 0.1);
}

body.ui-v2.nav-open .ui-nav-toggle span {
  opacity: 0;
}

body.ui-v2.nav-open .ui-nav-toggle::before {
  transform: translateY(6px) rotate(45deg);
}

body.ui-v2.nav-open .ui-nav-toggle::after {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 1380px) {
  body.ui-v2 > header #header .head-right .filing,
  body.ui-v2 > header #header .head-right .line {
    display: none;
  }

  body.ui-v2 > header #header .head-nav .head-nav-item > a {
    padding-inline: 8px;
    font-size: 13px;
  }
}

@media (max-width: 1180px) {
  body.ui-v2 .site-footer #footer .footer-top ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  body.ui-v2 > header {
    padding-left: max(var(--ui-mobile-header-gutter), env(safe-area-inset-left));
    padding-right: max(var(--ui-mobile-header-gutter), env(safe-area-inset-right));
  }

  body.ui-v2 > header #header,
  body.ui-v2 > header #header .header-outer {
    height: var(--ui-mobile-header-height) !important;
    min-height: var(--ui-mobile-header-height);
  }

  body.ui-v2 > header #header .head-logo {
    width: var(--ui-mobile-logo-width);
    height: var(--ui-mobile-logo-height);
    flex-basis: var(--ui-mobile-logo-width);
  }

  body.ui-v2 > header #header .head-left {
    position: static;
  }

  body.ui-v2 > header #header .head-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    width: auto;
    height: auto !important;
    max-height: 0;
    margin-left: 0 !important;
    padding: 0 18px;
    display: block;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    background: rgba(3, 17, 38, 0.98);
    box-shadow: 0 20px 40px rgba(0, 9, 28, 0.28);
    transition: max-height var(--ui-duration-normal), opacity var(--ui-duration-fast), visibility var(--ui-duration-fast);
  }

  body.ui-v2.nav-open > header #header .head-nav {
    max-height: min(70vh, 620px);
    padding-top: 10px;
    padding-bottom: 16px;
    overflow-y: auto;
    visibility: visible;
    opacity: 1;
  }

  /* Lock the viewport, not the sticky header's body ancestor. */
  html.ui-v2-root.ui-nav-scroll-locked {
    overflow: hidden;
  }

  body.ui-v2 > header #header .head-nav .head-nav-item {
    width: 100%;
  }

  body.ui-v2 > header #header .head-nav .head-nav-item > a {
    height: 46px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 15px;
  }

  body.ui-v2 > header #header .head-nav .head-drop {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
    display: none !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 12px 12px;
    box-sizing: border-box;
    border: 0;
    box-shadow: none;
    transform: none;
  }

  body.ui-v2 > header #header .head-nav .head-nav-item.is-open .head-drop {
    display: grid !important;
  }

  body.ui-v2 > header #header .head-nav .head-drop a {
    min-width: 0;
    padding: 9px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
  }

  body.ui-v2 > header #header .head-bottom {
    display: none !important;
  }

  body.ui-v2 > header #header .head-right .user {
    margin-right: 10px;
  }

  body.ui-v2 > header #header .head-right .login,
  body.ui-v2 > header #header .head-right .register {
    display: none;
  }

  body.ui-v2 .ui-nav-toggle {
    display: block;
  }
}

@media (max-width: 640px) {
  body.ui-v2 > header #header .head-right {
    display: none;
  }

  body.ui-v2 > header #header .header-outer {
    justify-content: space-between;
  }

  body.ui-v2 .ui-nav-toggle {
    margin-left: auto;
  }

  body.ui-v2 .site-footer #footer .footer-wrap,
  body.ui-v2 .site-footer #footer .footer-top,
  body.ui-v2 .site-footer #footer .footer-middle,
  body.ui-v2 .site-footer #footer .footer-bottom,
  body.ui-v2 .site-footer #footer .link-list {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.ui-v2 .site-footer #footer .footer-top,
  body.ui-v2 .site-footer #footer .footer-middle,
  body.ui-v2 .site-footer #footer .footer-bottom {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  body.ui-v2 .site-footer #footer .footer-top ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  body.ui-v2 .site-footer #footer .footer-top ul .footer-nav {
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
  }

  body.ui-v2 .site-footer #footer .footer-middle .middle-left,
  body.ui-v2 .site-footer #footer .footer-middle .middle-right,
  body.ui-v2 .site-footer #footer .footer-middle .middle-right > .clearfix,
  body.ui-v2 .site-footer #footer .footer-middle .col-wrap {
    float: none;
    width: 100% !important;
    min-width: 0;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.ui-v2 .site-footer #footer .footer-middle .middle-right {
    margin-top: 34px !important;
  }

  body.ui-v2 .site-footer #footer .footer-middle .middle-left .txt p {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  body.ui-v2 .site-footer #footer .footer-middle .col-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 18px;
  }

  body.ui-v2 .site-footer #footer .footer-middle .col-wrap .col {
    float: none;
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
  }

  body.ui-v2 .site-footer #footer .footer-bottom p {
    width: 100%;
    margin: 8px 0 0 !important;
    float: none;
  }

  body.ui-v2 #fixed {
    display: none !important;
  }

  body.ui-v2 .floating-button {
    top: auto !important;
    right: 10px !important;
    bottom: 10px !important;
    width: 44px !important;
    height: 44px !important;
  }

  body.ui-v2 .floating-button img {
    width: 44px !important;
    height: 44px !important;
  }
}

/* Full-width, content-height mobile navigation and account actions. */
@media (max-width: 1080px) {
  body.ui-v2.nav-open > header {
    z-index: 20000;
  }

  body.ui-v2 > header #header .head-nav {
    position: fixed;
    z-index: 121;
    top: 64px;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100vw;
    max-width: none;
    max-height: 0;
    padding-right: max(18px, env(safe-area-inset-right));
    padding-left: max(18px, env(safe-area-inset-left));
  }

  body.ui-v2.nav-open > header #header .head-nav {
    height: auto !important;
    max-height: calc(100dvh - 64px);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  body.ui-v2.nav-open > header #header .head-right {
    position: static;
    width: 100% !important;
    height: auto !important;
    min-height: 78px;
    margin: 10px 0 0;
    padding: 12px 0 0;
    display: flex !important;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(3, 17, 38, 0.98);
    box-shadow: none;
  }

  body.ui-v2.nav-open > header #header .head-right .filing {
    display: none !important;
  }

  body.ui-v2.nav-open > header #header .head-right .user {
    width: 100%;
    margin: 0;
  }

  body.ui-v2.nav-open > header #header .head-right .not-logged-in.active-show {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.ui-v2.nav-open > header #header .head-right .login,
  body.ui-v2.nav-open > header #header .head-right .register {
    width: auto;
    margin: 0;
    display: block !important;
    float: none;
  }

  body.ui-v2.nav-open > header #header .head-right .login .login-btn,
  body.ui-v2.nav-open > header #header .head-right .register .register-btn {
    width: 100% !important;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
  }

  body.ui-v2.nav-open > header #header .head-right .register-btn-wrap,
  body.ui-v2.nav-open > header #header .head-right .register-btn-wrap .register-btn {
    width: 100% !important;
  }

  body.ui-v2.nav-open > header #header .head-right .register-btn-wrap {
    display: block !important;
  }

  body.ui-v2.nav-open > header #header .head-right .register-btn-wrap .register-btn {
    border-color: transparent;
    background: linear-gradient(135deg, var(--ui-color-primary-500), #28bce6);
  }

  body.ui-v2.nav-open > header #header .head-right .log-in {
    width: 100%;
    height: auto !important;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .avatar,
  body.ui-v2.nav-open > header #header .head-right .log-in .to-down-icon {
    height: 44px;
    display: flex;
    align-items: center;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .avatar .avatar-wrap {
    display: flex;
    align-items: center;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .avatar .avatar-wrap img {
    width: 32px;
    height: 32px;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .to-down-icon {
    margin: 0 0 0 10px;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box {
    position: static !important;
    top: auto !important;
    right: auto !important;
    width: 100% !important;
    flex: 0 0 100%;
    margin-top: 8px;
    padding: 14px;
    box-sizing: border-box;
    border: 1px solid rgba(111, 183, 255, 0.22);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(10, 39, 85, 0.96), rgba(5, 24, 55, 0.98));
    box-shadow: 0 16px 34px rgba(0, 9, 28, 0.24);
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name {
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 16px;
    align-items: center;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .top {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .top h3,
  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .attestation-wrap {
    max-width: 100%;
    margin: 0;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name h3 span {
    display: block;
    overflow: hidden;
    font-size: 15px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .attestation-wrap .attest {
    text-align: left;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .attest span {
    font-size: 12px;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .money {
    margin: 0;
    align-items: center;
    justify-content: flex-end;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .money span {
    margin: 0 7px;
    padding: 0;
    font-size: 14px;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .name .money a {
    padding: 4px 9px;
    border-color: rgba(56, 214, 232, 0.62);
    border-radius: 8px;
    color: #75e6f4;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box ul {
    margin: 12px 0;
    padding: 10px 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    border-color: rgba(255, 255, 255, 0.14);
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box ul li a {
    min-width: 0;
    min-height: 38px;
    padding: 6px 8px;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box ul li a .icon {
    margin-top: 0;
    flex: 0 0 auto;
    font-size: 15px;
    color: #6fb7ff;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box ul li a span {
    min-width: 0;
    margin-left: 6px;
    overflow: hidden;
    flex: 0 1 auto;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .btn {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .btn a,
  body.ui-v2.nav-open > header #header .head-right .log-in .pop-up-box .btn .drop-out {
    min-height: 36px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    float: none;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.045);
  }
}
